Question

I am sharing a link using FBDialogs and as part of the tracking i want to give post_id of that shared post back to the server.

How can I retrieve post_id on success

[FBDialogs presentShareDialogWithLink:params.link
           name:params.name
           caption:params.caption
           description:params.description
           picture:params.picture
           clientState:nil
           handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
               if(error) {
               // An error occurred, we need to handle the error
               // See: https://developers.facebook.com/docs/ios/errors
               NSLog(@"%@",[NSString stringWithFormat:@"Error publishing story: %@", error.description]);
               } else {
               // Success
               NSLog(@"result %@", results);

               }
}];

There is nothing in the results Dictionary

Thanks

Was it helpful?

Solution

I believe the reason for there not being any information about the post in the result dictionary is that Facebook does not want app developers to know if there indeed was a post made.

Users can abort posting something but to the app it is still reported as success.

OTHER TIPS

To get the postId in the response you need to request publish permissions before presenting the FBDialog, otherwise the postId will not be present in the response. If you have a FBLoginView for example you could use:

[[FBLoginView alloc] initWithPublishPermissions:@[@"publish_actions"] defaultAudience:FBSessionDefaultAudienceEveryone];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top