深度链接 - 从Facebook重定向到ios应用程序无法正常工作

时间:2018-03-07 10:56:39

标签: ios facebook deep-linking applinks

我无法从facebook帖子重定向到我的iOS应用。当我点击该帖子时,它会以网页形式打开(不知何故为iOS标识标签并且不会重定向到应用程序)。不确定它是ios应用程序或HTML内容还是其他一些问题。

我在我的HTML页面中集成了Facebook APP Link元标记,如下所示。

在我的情况下,URLScheme名称是“fbXXXXXXX”

 <meta property="fb:app_id" content=<fb_APP_ID> />
 <meta property="al:ios:app_store_id" content=<appstoreid> />
 <meta property="al:ios:url" content="fbXXXXXXX://eventid/12345" />
 <meta property="al:ios:app_name" content=<App name> />

LSApplicationQueriesSchemes

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>

enter image description here

AppDelegate.m

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

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

BFURL *parsedUrl = [BFURL URLWithInboundURL:url sourceApplication:sourceApplication];
if ([parsedUrl appLinkData]) {
    [self handleDeeplinkURL:url];

}

return YES;

}

因为直接共享网址是有效的,所以我非常有信心我已经正确设置了深层链接,所以我认为它必须是开放图形的。

2 个答案:

答案 0 :(得分:0)

通过链接分享,您的意思是您可以使用此链接运行您的应用 myapp:// eventid / 12345

如果没有,您应该检查您的Info.plist,如果您已为您的应用程序注册了URL Scheme。该方案的名称应与您在Facebook应用设置中定义的相同,在您的情况下,它是“myapp”

Info.plist screenshot

答案 1 :(得分:0)

这绝对是一个applinks问题,而不是iOS uri方案配置问题。

可能是Facebook还没有为这些应用链接抓取您的网页。您应该将链接放在Facebook Debugger中的HTML页面上,以测试您的applinks元标记是否有效。