Search code examples
iosxcodesslflickr

iOS FlickrKit: err code="95" msg="SSL is required"


I am developing a photo sharing application on iOS that shares pictures on various social networks including Flickr. In order to authorise the app and to upload photos on a Flickr photo-stream I use FlickrKit.

After successfully authorising the app I try to post the selected picture with the following code:

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];
            }

        });
    }]; 

My problem is that the following error occurs:

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>

Does anyone have an idea where do I set an SSL connection for FlickrKit?

Thank you very much,

Granit


Solution

  • During my research I saw that the Flickr API is now SSL-Only form June 27th 2014. The fix is to change upload URL in FKImageUploadNetworkOperation.m file to:

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