简体   繁体   中英

sharing a graph story with UIImage using Facebook sdk

I'm trying to generate a story object and post it to facebook using facebook share dialog. it works well with only one issue:

i'm trying to use an UIImage instead of image url.

when the share dialog is opened, i can see the image selected by the user. after posting, i can see on facebook.com site an image from my site.com instead of the UIImage i sent.

Any ideas ?

 NSMutableDictionary<FBGraphObject> *object =
    [FBGraphObject openGraphObjectForPostWithType:@"name_app:artwork"
                                            title:@"User generated content"
                                            image:self.artworkImage
                                              url:self.myAppWebSiteUrl
                                      description:@""];;

    id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
    action[@"artwork"] = object;


    if ( [FBDialogs canPresentShareDialogWithOpenGraphActionParams:action]) {
        [FBDialogs presentShareDialogWithOpenGraphAction:action
                                              actionType:@"name_app:contribute"
                                     previewPropertyName:@"artwork"
                                                 handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                                     [self close];
                                                     if(error) {
                                                         NSLog(@"Error: %@", error.description);
                                                     } else {
                                                         NSLog(@"Success");
                                                     }
                                                 }];

    }

I believe your self.artworkImage associated to the object's image parameter is used as a thumbnail to the url . If I understood correctly you want to send the UIImage as a part of the story - in that case you should assign your UIImage to the action's image object. Check this link for how to append local images to your story.

Let me know if it helped you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM