Facebook app邀请iOS SDK无法显示邀请VC

时间:2017-05-03 15:48:37

标签: ios swift facebook cocoa-touch

所以这是我的app邀请代码:

private func inviteFriends() {

    let content = FBSDKAppInviteContent()
    content.appLinkURL = URL(string: "...")
    content.appInvitePreviewImageURL    = URL(string: "...")
    FBSDKAppInviteDialog.show(from: self, with: content, delegate: nil)
}

此代码工作正常,但如果我尝试添加这样的促销代码:

private func inviteFriends() {

    let content = FBSDKAppInviteContent()
    content.appLinkURL = URL(string: "...")
    content.appInvitePreviewImageURL    = URL(string: "...")
    content.promotionCode = "preview"
    content.promotionText = "Use the *preview* code to unlock the app"
    FBSDKAppInviteDialog.show(from: self, with: content, delegate: nil)
}

邀请VC不再显示(调用该函数但没有显示任何内容)。我在这里错过了什么?

1 个答案:

答案 0 :(得分:3)

问题在于我使用了*这样的特殊字符,所以删除它会让应用程序运行正常,我的最终代码是这样的:

private func inviteFriends() {

    let content = FBSDKAppInviteContent()
    content.appLinkURL = URL(string: "...")
    content.appInvitePreviewImageURL    = URL(string: "...")
    content.promotionCode = "preview"
    content.promotionText = "Use the preview code to unlock the app"
    FBSDKAppInviteDialog.show(from: self, with: content, delegate: nil)
}