2017-05-03 2 views
1

Donc, c'est mon code pour l'application inviter:application Facebook invitation iOS SDK ne peut pas afficher l'invitation VC

private func inviteFriends() { 

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

Ce code fonctionne très bien, mais si je tente d'ajouter le code promotionnel comme ceci:

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) 
} 

L'invite VC n'est plus affichée (la fonction est appelée mais rien ne s'affiche). Qu'ai-je manqué ici?

+0

Avez-vous essayé d'initialiser un objet FBSDKAppInviteDialog puis appeler ce spectacle ? –

+0

Non, j'ai juste essayé de suivre ceci: https://developers.facebook.com/docs/app-invites/ios – Chlebta

Répondre

3

La question était que je l'ai utilisé comme caractère spécial * afin de le retirer faire l'application fonctionne très bien mon code final est comme ceci:

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) 
}