我在 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">
在我的应用委托(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 应用程序设置。
最佳答案
更改 <meta property="al:ios:url" content="appname://event?event_id=127">
到
<meta property="al:ios:url" content="myApp://event?event_id=127">
您的应用程序将识别您的 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>
关于ios - 深层链接 Facebook iOS - 应用程序打不开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35083555/