Detect successful facebook post using FBDialogs
I'm trying to present the facebook share dialog from my iOS app.
This code opens the facebook app and shows the dialog:
FBShareDialogParams* params = [[FBShareDialogParams alloc] init];
params.link = urlToShare;
params.name = @"Test";
params.description = @"Description";
params.picture = [NSURL URLWithString:FB_IMG_URL];
BOOL canPresentShareDialog = [FBDialogs
canPresentShareDialogWithParams:params];
if (canPresentShareDialog) {
[FBDialogs presentShareDialogWithParams:params clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if (error) {
if ([FBErrorUtility shouldNotifyUserForError:error]) {
UIAlertView* alert = [[UIAlertView alloc]
initWithTitle:@"Facebook-Error!" message:[FBErrorUtility
userMessageForError:error] delegate:nil
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
} else {
NSLog(@"SUCCESS");
}
}];
}
In the completion handler I want to know if the user canceled the action.
The results dictionary should tell me that. However I only get
didComplete=YES in the dictionary but not a completionGesture. The NSError
object is always nil.
The results dictionary is explained here:
https://developers.facebook.com/ios/share-dialog/
So the problem is I can't tell if the post was successful or not.
Is something wrong with my code?
No comments:
Post a Comment