【问题标题】:Deep Linking Facebook iOS - App don't open深度链接 Facebook iOS - 应用程序无法打开
【发布时间】:2016-05-07 03:08:58
【问题描述】:

我在集成 Facebook 深层链接(从文章到我的应用程序)时遇到问题。我一步步跟着文档(https://developers.facebook.com/docs/applinks),没什么可做的,它不起作用..

所以在我的网站中,我添加了元数据:

<meta property="fb:app_id" content="...">
<meta property="al:ios:url" content="appname://event?event_id=127">
<meta property="al:ios:app_name" content="app name">

在我的应用委托中:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {



BFURL *parsedUrl = [BFURL URLWithInboundURL:url sourceApplication:sourceApplication];
if ([parsedUrl appLinkData]) {
    // this is an applink url, handle it here
    NSURL *targetUrl = [parsedUrl targetURL];
    [[[UIAlertView alloc] initWithTitle:@"Received link:"
                                message:[targetUrl absoluteString]
                               delegate:nil
                      cancelButtonTitle:@"OK"
                      otherButtonTitles:nil] show];
}

return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                      openURL:url
                                            sourceApplication:sourceApplication
                                                   annotation:annotation
        ];}

您知道为什么我的应用没有打开吗? 我还配置了我的 Facebook 应用设置。

【问题讨论】:

    标签: ios facebook hyperlink deep-linking


    【解决方案1】:

    更改&lt;meta property="al:ios:url" content="appname://event?event_id=127"&gt;&lt;meta property="al:ios:url" content="myApp://event?event_id=127"&gt;

    您的应用程序将识别您的 url 设置的方案,在这种情况下是 myApp(您可以将其更改为您想要的字符串,但两者都应该匹配)。因此,这应该出现在您应用的 plist 中,以识别打开的来电。

    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>myApp</string>
                <string>fbXXXXXXXXXXXXXXXX</string>
            </array>
        </dict>
    </array>
    

    【讨论】:

    • 不行……当你说myApp的时候,我得把myApp改成我的app的名字?
    • 兄弟你不必更改应用程序名称我建议的是模式名称,您的应用程序将通过它识别来自 facebook 的回调 url。它应该匹配
    • 干杯!这很有帮助,我使网络元 URL 和应用程序架构等于 FB 的回调
    猜你喜欢
    • 2017-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-23
    • 2022-01-08
    • 1970-01-01
    • 2019-09-14
    • 1970-01-01
    相关资源
    最近更新 更多