Sometimes the Facebook share dialog doesn't load on iOS

淺唱寂寞╮ 提交于 2019-11-30 05:17:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!