0

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

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Mihir Mehta
  • 13,743
  • 3
  • 64
  • 88

2 Answers2

1

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.

Cocoanetics
  • 8,171
  • 2
  • 30
  • 57
  • Ok... So that means there is no way we can retrieve post_id from mobile app ... Strangely FBWebDialogs which is fallback mechanism of FBDialogs when app is not installed provides post_id... – Mihir Mehta Apr 17 '14 at 11:58
  • Facebook's iOS SDK is on GitHub. You should post this as an issue [there](https://github.com/facebook/facebook-ios-sdk). – Cocoanetics Apr 17 '14 at 12:02
0

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