Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nil resultURL after successfully posting with FBWebDialogs (Facebook SDK 3.5)

I'm integrating Facebook on my application to share links of websites. I'm using the Feed Dialog to accomplish this and I'm following this tutorial:
https://developers.facebook.com/docs/howtos/feed-dialog-using-ios-sdk/.

I've managed to login and post to Facebook but I wanted to add a message when the post was successful. The tutorial has this built in, but every time I post, I see "User canceled story publishing." in the Log which is the message that is displayed when the user clicks on cancel. Besides I've confirmed with the debugger that the param resultURL received by the handler is always nil even on successful posts.

At first I though it was a configuration issue in my Facebook App, but I decided to make a test. I opened the RPSSample that comes with the framework, added a completion handler to the presentRequestsDialogModallyWithSession call in the clickInviteFriends method in the RPSFriendsViewController.m view controller and I was getting a nil resultURL on successful posts there too.

I'm I missing something?

I know the 3.5 SDK version is very new, but according to the documentation I should be getting a valid resultURL param after posting through a Facebook Web Dialog so I'm not sure if it's a bug or if I'm missing some callback or handler somewhere.

Just in case, this is my call to the Feed Web Dialog. It has minor changes compared to the one that comes in the tutorial (it's actually simpler)

- (void)publish: (EntityToShare *)entityToShare {
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
 entityToShare.link, @"link",
 nil];

// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
                                       parameters:params
                                          handler:
 ^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
     if (error) {
         // Error launching the dialog or publishing a story.
         NSLog(@"Error publishing story.");
     } else {
         if (result == FBWebDialogResultDialogNotCompleted) {
             // User clicked the "x" icon
             NSLog(@"User canceled story publishing.");
         } else {
             // Handle the publish feed callback
             NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
             if (![urlParams valueForKey:@"post_id"]) {
                 // User clicked the Cancel button
                 NSLog(@"User canceled story publishing.");
             } else {
                 // User clicked the Share button
                 NSString *msg = [NSString stringWithFormat:
                                  @"Posted story, id: %@",
                                  [urlParams valueForKey:@"post_id"]];
                 NSLog(@"%@", msg);
                 // Show the result in an alert
                 [[[UIAlertView alloc] initWithTitle:@"Result"
                                             message:msg
                                            delegate:nil
                                   cancelButtonTitle:@"OK!"
                                   otherButtonTitles:nil]
                  show];
             }
         }
     }
 }];
}
like image 488
Diego Isaac Montenegro Jiménez Avatar asked Apr 23 '13 22:04

Diego Isaac Montenegro Jiménez


1 Answers

We have a fix for this in place and will be pushed out soon.

Edited:

This has now been fixed in the SDK release 3.5.1 Check it out here: https://developers.facebook.com/ios/

like image 117
Shireesh Asthana Avatar answered Oct 31 '22 01:10

Shireesh Asthana