【发布时间】:2015-09-28 15:39:04
【问题描述】:
我需要在我的应用中发送应用邀请,并希望为此使用原生 iOS Facebook 应用(如果已安装)。
我在装有 iOS 9.0.1 并安装了本机 Facebook 应用程序的 iPhone 上运行它,但对话框总是启动浏览器。它只是不启动 Facebook 应用程序。
这是我的代码:
let appLinkUrl:NSURL = NSURL(string: "https://fb.me/xxx")!
var inviteContent:FBSDKAppInviteContent = FBSDKAppInviteContent()
inviteContent.appLinkURL = appLinkUrl
FBSDKAppInviteDialog.showFromViewController(self, withContent: inviteContent, delegate: self)
我的 info.plist 看起来像这样
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbxxx</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>xxx</string>
<key>FacebookDisplayName</key>
<string>xxx</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
此外,所有与NSAppTransportSecurity 相关的条目,如快速入门指南中的条目。
【问题讨论】:
-
正确。这是因为 Apple 对 iOS9 所做的更改
-
@WizKid 所以没有办法为此启动 Facebook 应用程序?
-
@WizKid 这不是真的!正如他们的文档清楚地表明
Facebook Login is not required for app invites because the experience takes place in the Facebook native mobile app. -
你能链接到那个,这样我可以告诉然后改变它
-
@WizKid 在这里声明developers.facebook.com/docs/app-invites/overview
标签: ios facebook swift facebook-ios-sdk