Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sometimes the Facebook share dialog doesn't load on iOS

Sometimes when I launch the Facebook share dialog, the OS switches to the Facebook app, but the share dialog doesn't load. Then if you try again, it usually works. Why doesn't it work the first time?

NSURL* url = [NSURL URLWithString:@"some URL"];
FBShareDialogParams* params = [[FBShareDialogParams alloc] init];
params.link = url;
 if ([FBDialogs canPresentShareDialogWithParams:params]) {
     [FBDialogs presentShareDialogWithLink:url
                                   handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                       if(error) {
                                           NSLog(@"Error posting to FB: %@", error.description);
                                           //do something
                                       } else {
                                           //do something else
                                       }
                                   }];
//    }
 }
like image 229
shim Avatar asked Jul 16 '13 19:07

shim


People also ask

What is Facebook dialog?

The Login Dialog allows someone to use Facebook Login to grant permissions to an app. The Add Page Tab Dialog allows someone to add an app to a tab on a Facebook Page which they admin. The Requests Dialog allows someone to send a request to one or more of their friends from a game.

What is the share sheet on Facebook?

Share Sheet lets you preview your post before it reaches your Facebook feed and offers options to share with particular people.


1 Answers

This class is no longer available in the most recent version of the SDK.

You should use FBSDKShareDialog instead of this.The latest version is v4.11.0.

Thanks.

like image 195
Banker Mittal Avatar answered Nov 10 '22 16:11

Banker Mittal