FBSDKShareDialog of Facebook SDK is not working on iOS9?

后端 未结 2 740
囚心锁ツ
囚心锁ツ 2020-12-14 12:49

With Xcode7, I upgrade Facebook SDK to pod FBSDKShareKit (4.6.0). And I have added Facebook scheme to WhiteList as below. reference: https://developers.facebook.com/docs/io

2条回答
  •  遥遥无期
    2020-12-14 13:05

    I'm guessing Facebook changed the behaviour because iOS 9 now pops up a dialog asking if you would like to "Open Facebook?" when doing app-switching. Even for FBSDKLoginManager, the app-switching (native) method seems to be less preferred than a modal UIWebView.

    However, you can still force the share dialog to switch to the Facebook app (assuming you have your application plist setup as described in https://developers.facebook.com/docs/ios/ios9) by using this method:

    FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
    
    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
        dialog.mode = FBSDKShareDialogModeNative;
    }
    else {
        dialog.mode = FBSDKShareDialogModeBrowser; //or FBSDKShareDialogModeAutomatic
    }
    dialog.shareContent = content;
    dialog.delegate = self;
    dialog.fromViewController = self;
    [dialog show];
    

提交回复
热议问题