Adding a photo to Open Graph story didn't upload a photo

137 views Asked by At

When I post a story to the Facebook with the code below, the image is not shown on my feed (just show the story title) and not uploaded to my photo album. The image is already uploaded to my server with 1000x1000 dimension and taken by user on the iPhone.

Most weird thing is it works properly from time to time (1/10?) and I couldn't find the cause what make it work properly.

I'm using Facebook SDK for iOS 3.22

Any idea or suggestions would be really appreciated. Thank you.

NSArray *images = @[@{@"url": imageURLString, @"user_generated": @"true"}];
    NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPostWithType:@"[AppName]:photo"
                                                                                             title:caption
                                                                                             image:nil
                                                                                               url:urlString
                                                                                       description:@""];
    object.provisionedForPost = YES;
    id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
    [action setObject:images forKey:@"image"];
    [action setObject:object forKey:@"photo"];
    [action setObject:@"true" forKey:@"fb:explicitly_shared"];
    [action setObject:caption forKey:@"message"];

    [FBRequestConnection startForPostWithGraphPath:@"me/[AppName]:share"
                                       graphObject:action
                                 completionHandler:^(FBRequestConnection *connection,
                                                     id result,
                                                     NSError *error) {
                                     if (error) {
                                         NSLog(@"%@", [error localizedDescription]);
                                     }
                                 }];
0

There are 0 answers