在FBSDKAppInviteDialog中获取错误(错误域= com.facebook.sdk.core代码= 9“(null)”)

时间:2018-03-08 10:46:00

标签: ios fbsdksharedialog fbsdkappinvitecontent

我在facebook.developer.i中成功创建了AppId,并在info.plist文件中添加了urlscheme。

这是我的代码

var inviteDialog : FBSDKAppInviteDialog = FBSDKAppInviteDialog()
        if(inviteDialog.canShow()){
            let appLinkUrl:NSURL = NSURL(string: "https://fb.me/*******")!
            let previewImageUrl:NSURL = NSURL(string: "http://yourwebpage.com/preview-image.png")!

            let inviteContent:FBSDKAppInviteContent = FBSDKAppInviteContent()
            inviteContent.appLinkURL = appLinkUrl as URL!
            inviteContent.appInvitePreviewImageURL = previewImageUrl as URL!

            inviteDialog.content = inviteContent
            inviteDialog.delegate = self
            inviteDialog.show()
        }

未显示邀请对话框获取错误,如

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。因此,我下载了最新的SDK,发现Facebook SDK版本4.28及更高版本不再支持App Invites。我从developers site下载了最新的SDK版本4.33.0,当我打开FBSDKAppInviteDialog类时,发现以下方法已被弃用,编写如下。

+ (instancetype)showFromViewController:(UIViewController *)viewController
                           withContent:(FBSDKAppInviteContent *)content
                              delegate:(id<FBSDKAppInviteDialogDelegate>)delegate
__attribute__ ((deprecated("App Invites no longer supported")));


/**

 - Warning:use showFromViewController:withContent:delegate: instead
 */
+ (instancetype)showWithContent:(FBSDKAppInviteContent *)content delegate:(id<FBSDKAppInviteDialogDelegate>)delegate
__attribute__ ((deprecated("use showFromViewController:withContent:delegate: instead")));