Swift 中带有 Branch.io 的 Facebook AppInvites 示例

Posted

技术标签:

【中文标题】Swift 中带有 Branch.io 的 Facebook AppInvites 示例【英文标题】:Examples of Facebook AppInvites with Branch.io in Swift 【发布时间】:2015-06-11 07:47:16 【问题描述】:

Branch 有很好的示例,说明如何在 Swift 中使用 AppLinks 创建深层链接,但我找不到任何有关如何在 Swift 中创建 Facebook 的 AppInvites 的示例。有人做过吗?

【问题讨论】:

【参考方案1】:

此处解决方案的工作分支:Swift implementation of FBSDKAppInviteDialogDelegate not working

生成分支 URL 并从那里的回调中显示共享对话框。

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

【讨论】:

以上是关于Swift 中带有 Branch.io 的 Facebook AppInvites 示例的主要内容,如果未能解决你的问题,请参考以下文章