Reputation: 12398
I use the following code found on Facebook developer site to do a wall post:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"http://developers.facebook.com/docs/reference/dialogs/", @"link",
@"http://fbrell.com/f8.jpg", @"picture",
@"Facebook Dialogs", @"name",
@"Reference Documentation", @"caption",
@"Dialogs provide a simple, consistent interface for apps to interact with users.", @"description", nil];
[_facebook dialog:@"feed" andParams:params andDelegate:self];
This shows a popup letting the user write his message and press publish or cancel.
Is there any way to know if the post has been successfully pusblished or not (cancellation or connection problem)?
Many thanks!
Upvotes: 1
Views: 2604
Reputation: 2492
Somewhat related to your question - I was trying to figure out which dialog had completed.
You can detect the parameters of the dialog, and check which one it is. I have this issue, as I send various dialogs, and want to know on the other end which one was a success or not.
- (void)dialogDidComplete:(FBDialog *)dialog {
// the song feed return
NSLog(@"params; %@",dialog.params);
if([[dialog.params objectFOrKey:@"ref"] isEqualtoString:@"songfeed"]){
// do stuff on return from this dialog
}
}
Upvotes: 0
Reputation: 12398
+1 for Hlung and DMCS for their help but it looks like the feed dialog is getting more and more deprecated, and handling proper callbacks is fiddly (impossible?). Plus the FB doc isn't up-to-date.
So I ended up using a (void)requestWithGraphPath
instead of (void)dialog
which requires an extra permission to post on user's wall but works better with the 2 following callbacks:
- (void)request:(FBRequest *)request didLoad:(id)result
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error
Upvotes: 0
Reputation: 31870
Try using specifying a delegate other than self to be able to capture the response of the dialog.
See: http://developers.facebook.com/docs/reference/iossdk/dialog/
You should call this dialog if the method you are calling requires parameters to set up the dialog. You should set up your delegate to handle the scenarios where the dialog succeeds, is cancelled by the user, as well as any error scenarios.
As for the delegate: http://developers.facebook.com/docs/reference/iossdk/FBRequestDelegate/ I would assume it would be the request:didReceiveResponse:
delegate.
EDIT
with additional feedback, your answer lies in the dialogDidComplete
delegate listed on the link I gave in my original response.
Upvotes: 3
Reputation: 14298
I think you can do it by using - (void)dialogDidComplete:(FBDialog *)dialog;
method of FBDialogDelegate.
Upvotes: 2