问题
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
}
}];
// }
}
回答1:
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.
来源:https://stackoverflow.com/questions/17684886/sometimes-the-facebook-share-dialog-doesnt-load-on-ios