简体   繁体   English

Facebook App邀请不起作用

[英]Facebook App Invite not working

I'm trying to add facebook App Invite like this: 我正在尝试像这样添加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()

Relevant Info.plist keys: 相关的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>

When I run the code, safari window is opened, and closed after showing loading spinner. 当我运行代码时,Safari浏览器窗口会打开,并在显示加载微调框后关闭。

This error is returned: 返回此错误:

"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 app is installed on the device, and share dialog opens in facebook app. Facebook应用程序已安装在设备上,并在facebook应用程序中打开“共享”对话框。

When i try to debug, in [FBSDKApplicationDelegate _handleBridgeAPIResponseURL:sourceApplication:] response URL is 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 当我尝试调试时,在[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

relevant error: 相关错误:

{"error":"server_error","error_description":"Error retrieving application configuration."}

I'm not sure what that error means, is facebook application config wrong, or iOS application. 我不确定该错误的含义是Facebook应用程序配置错误还是iOS应用程序错误。

The same invite works on Android, iOS app is published, and has valid iTunes URL configured. 相同的邀请适用于Android,iOS应用已发布,并且已配置有效的iTunes URL。

I was able to invite friends based on the above code so please check the facebook app id and see whether it is entered correctly. 我能够根据上述代码邀请朋友,所以请检查facebook应用ID,看看是否输入正确。 And see whether you have provided the correct url identifier and url scheme in the p list. 并查看您在p列表中是否提供了正确的url标识符和url方案。

Can you try and see if it works in wifi. 您可以尝试看看它是否可以在wifi中使用。 It seems there is a bug in facebook App Invite which doesn't work in mobile data but works when using wifi (getting the same error as above.) 看来facebook App Invite中存在一个错误,该错误在移动数据中不起作用,但在使用wifi时起作用(得到与上述相同的错误。)

https://developers.facebook.com/bugs/798217780334522/ https://developers.facebook.com/bugs/798217780334522/

If it is working in wifi and not working in mobile data pls report thru that link above to resolve it. 如果它在wifi中工作而不在移动数据中工作,请通过上面的链接进行报告以解决该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM