Examples of Facebook AppInvites with Branch.io in Swift

406 views Asked by At

Branch has great examples of how to create their deep links with AppLinks in Swift but I can't find any examples of how to create Facebook's AppInvites in Swift. Has anyone done this yet?

1

There are 1 answers

0
Francis Jervis On BEST ANSWER

Branch for works following the solution here: Swift implementation of FBSDKAppInviteDialogDelegate not working

Generate the Branch URL and present the share dialog from the callback there.

var inviteDialog: FBSDKAppInviteDialog = FBSDKAppInviteDialog()

Branch.getInstance().getShortURLWithParams(params, andChannel: "facebook", andFeature: "app_invite", andCallback: { (branchUrl: String?, error: NSError?) -> Void in

                if error == nil {

                var inviteContent: FBSDKAppInviteContent = FBSDKAppInviteContent()

                inviteContent.appLinkURL = NSURL(string: branchUrl!)!

                inviteDialog.content = inviteContent
                inviteDialog.delegate = self
                inviteDialog.show()
            }
        })