ios - Facebook App邀请不起作用

标签 ios iphone facebook facebook-ios-sdk

我正在尝试像这样添加facebook App Invite:

let content:FBSDKAppInviteContent = FBSDKAppInviteContent()
        content.appLinkURL = URL(string: "https://fb.me/...")
        content.appInvitePreviewImageURL = URL(string: "http://...")

        let dialog = FBSDKAppInviteDialog()
        dialog.content = content
        dialog.delegate = self
        dialog.fromViewController = self
        dialog.show()

相关的Info.plist键:
<key>FacebookAppID</key>
<string>...</string>
<key>FacebookDisplayName</key>
<string>Blanket</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fbapi20130214</string>
    <string>fbapi20130410</string>
    <string>fbapi20130702</string>
    <string>fbapi20131010</string>
    <string>fbapi20131219</string>
    <string>fbapi20140410</string>
    <string>fbapi20140116</string>
    <string>fbapi20150313</string>
    <string>fbapi20150629</string>
    <string>fbapi20160328</string>
    <string>fbauth</string>
    <string>fbauth2</string>
    <string>fb-messenger-api20140430</string>
    <string>fb-messenger-platform-20150128</string>
    <string>fb-messenger-platform-20150218</string>
    <string>fb-messenger-platform-20150305</string>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>com.my.app</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb...</string>
            <string>myappscheme</string>
        </array>
    </dict>
</array>

当我运行代码时,Safari浏览器窗口会打开,并在显示加载微调器后关闭。

返回此错误:
"Error: Optional(Error Domain=com.facebook.sdk.core Code=2 \"(null)\" UserInfo={com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid method_results., com.facebook.sdk:FBSDKErrorArgumentNameKey=method_results})"
Facebook应用程序已安装在设备上,并在facebook应用程序中打开“共享”对话框。

当我尝试调试时,在[FBSDKApplicationDelegate _handleBridgeAPIResponseURL:sourceApplication:]中,响应URL为fb...://bridge/appinvites?version=web&bridge_args=%7B%22app_name%22%3A%22...%22%2C%22action_id%22%3A%...%22%7D&error=%7B%22error%22%3A%22server_error%22%2C%22error_description%22%3A%22Error%20retrieving%20application%20configuration.%22%7D
相关错误:
{"error":"server_error","error_description":"Error retrieving application configuration."}

我不确定该错误的含义是Facebook应用程序配置错误还是iOS应用程序错误。

相同的邀请适用于Android,iOS应用已发布,并且已配置有效的iTunes URL。

最佳答案

我能够根据上述代码邀请 friend ,所以请检查facebook应用ID,看看是否输入正确。并查看您在p列表中是否提供了正确的url标识符和url方案。

关于ios - Facebook App邀请不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43412286/

相关文章:

android - 为什么移动特定的 css 似乎只针对屏幕尺寸?

ios - 无法在真实 iPhone 上使用 @ObservedObject

iphone - 如何增加 iPhone 中 UITextField 的高度

iphone - Push Notification 推送出现两次?

javascript - Canvas 到图像无法在 'toDataURL' : Tainted canvases may not be exported 上执行 'HTMLCanvasElement'

html - UIWebview:如何在 html 链接之前放置一个图标并在点击时突出显示

iphone - 检测 UIImageView 在 UITableViewCell 中的点击

android - 在 Facebook 上分享时如何更改 Play Store 应用程序的预览?

facebook - ASP.NET Core Facebook 身份验证中间件用户图片

ios - 如何在快速向上/向下滚动时同时隐藏/显示 View