Chlebta
Chlebta

Reputation: 3110

Facebook app invitation iOS SDK can't display the Invitation VC

So this's my code for app invite :

private func inviteFriends() {

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

This code works fine but if I try to add the promotional code like this :

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

The the invite VC is not shown any more (the function is called but nothing is showing). What did I missed here ?

Upvotes: 1

Views: 178

Answers (1)

Chlebta
Chlebta

Reputation: 3110

The issue was that I've used special character like * so removing it make the app works fine my final code is like this :

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

Upvotes: 3

Related Questions