iOS FlickrKit:错误代码=“95”msg =“需要SSL”

时间:2014-07-02 08:23:41

标签: ios xcode ssl flickr

我正在iOS上开发一个照片共享应用程序,在各种社交网络上共享图片,包括Flickr。为了授权应用并在Flickr照片流上传照片,我使用FlickrKit

成功授权应用程序后,我尝试使用以下代码发布所选图片:

UIImage *img = self.itemsToShare[currentItem];

    NSDictionary *uploadArgs = @{@"title": @"Test Photo", @"description": @"A Test Photo via FlickrKitDemo", @"is_public": @"0", @"is_friend": @"0", @"is_family": @"0", @"hidden": @"2"};

    self.uploadOp = [[FlickrKit sharedFlickrKit] uploadImage:img args:uploadArgs completion:^(NSString *imageID, NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            if (error) {
                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
                [alert show];
            } else {
                NSString *msg = [NSString stringWithFormat:@"Uploaded image ID %@", imageID];
                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Done" message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
                [alert show];
            }

        });
    }]; 

我的问题是发生以下错误:

2014-07-02 10:16:23.710 myApp[805:3507] <?xml version="1.0" encoding="utf-8" ?>
<rsp stat="fail">
    <err code="95" msg="SSL is required" />
</rsp>

有没有人知道我在哪里为FlickrKit设置SSL连接?

非常感谢,

花岗岩

3 个答案:

答案 0 :(得分:4)

在我的研究中,我看到Flickr API现在是SSL-Only形成于2014年6月27日。修复方法是将FKImageUploadNetworkOperation.m文件中的上传URL更改为:

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://up.flickr.com/services/upload/"]];
    [request setHTTPMethod:@"POST"];

答案 1 :(得分:1)

您需要更新的是从HTTP到HTTPS的URL:

https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=.............&photoset_id=...............&format=rest

为我工作!

答案 2 :(得分:0)

由于安全连接问题,您只需在flickr API中将http替换为https