深度链接Facebook iOS - 应用程序无法打开

时间:2016-01-29 11:36:08

标签: ios facebook hyperlink deep-linking

我在整合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">

在我的app delegate中:

- (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应用程序设置。

1 个答案:

答案 0 :(得分:1)

更改<meta property="al:ios:url" content="appname://event?event_id=127"> 至     <meta property="al:ios:url" content="myApp://event?event_id=127">

您的应用会识别您的网址设置的方案,在这种情况下是 myApp (您可以将其更改为所需的字符串,但两者都应匹配)。因此,这应存在于您应用的播放器中以识别来电打开。

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myApp</string>
            <string>fbXXXXXXXXXXXXXXXX</string>
        </array>
    </dict>
</array>
相关问题