我在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()
}
未显示邀请对话框获取错误,如
答案 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")));