2017-05-03 165 views
1

所以這是我的應用程序代碼的邀請:Facebook應用程序邀請的iOS SDK無法顯示邀請VC

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不再顯示(該函數被調用,但沒有顯示)。我在這裏錯過了什麼?

+0

你試過初始化FBSDKAppInviteDialog對象,然後調用這個節目? –

+0

不,我只是試圖按照這個:https://developers.facebook.com/docs/app-invites/ios – Chlebta

回答

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) 
} 
相關問題