1

我已经在 facebook.developer 中成功创建了 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()
        }

不显示邀请对话框出现错误

4

1 回答 1

0

我遇到了同样的问题。因此,我下载了最新的 SDK,发现 Facebook SDK 4.28 及更高版本不再支持 App Invites。我从开发者网站下载了最新的 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")));
于 2018-06-12T13:18:44.023 回答