[英]Facebook Share Dialog Deep Linking iOS
我相信我在iOS应用程序上设置了所有适当的深层链接。 用户可以使用Facebook应用程序(如果没有)登录到我们的应用程序,如果没有,则可以使用Safari登录,并在完成后正确地重定向回我们的应用程序。
当用户在本机iOS应用程序中点击“-通过应用程序名称共享”时,我很难尝试实现相同的重定向。 我想遵循预期的流程,如果他们没有安装应用程序,它将把用户带到App Store,如果他们这样做,则会打开我的应用程序。 现在,无论是否安装了该应用程序,都会将用户定向到该应用程序商店。
我的fb应用程序的设置(出于显而易见的原因,大多数值都被混淆了)如下:
请注意 ,在上面的图像中,大多数空白/看似空的值实际上都存在并且适当,只是出于保密目的将其从图像中删除,这使它们显得为空 ,但并非如此。
我大约在6个月前左右就在以前的应用程序上进行过这项工作,但是据我了解,Facebook自此已切换到App Links ,尽管我似乎已经阅读了有关该主题的所有文档,但我可以为了我的一生,现在就让它开始工作。
我开始怀疑这是否不是我们需要在Web端配置的东西。 现在共享的网页是否需要嵌入可将用户定向到适当位置的元标记,即该页面是否需要嵌入我的应用程序的URL方案-app-name://或什么?
从Facebook iOS应用程序上的共享重定向需要做些什么与从iOS iOS应用程序登录的重定向不同吗?
Facebook文档非常不完整。.我不得不从该网站上删除一些信息: http : //applinks.org/documentation/
在我的应用中,我通过“ example.com/share.php”之类的链接共享所有故事,并且share.php文件中的代码如下:
<?php
require 'Mobile_Detect.php'; //you need to download this
$detect = new Mobile_Detect;
//if user is accessing the "shared history" from the facebook website
//it should be redirected to the website, not allowing him to browse this
//page, as it is empty.
//
//the regex avoids the redirect for facebook crawler
if (!preg_match('%facebookexternalhit/1.*%si', $_SERVER["HTTP_USER_AGENT"])) {
if (!$detect->isiOS() && !$detect->isAndroidOS()) {
header("Location: http://www.example.com/");
die();
}
}
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>App Share Page</title>
<!-- This disables the intermediate web view in mobile, jumping straigt to the app -->
<meta property="al:web:should_fallback" content="false">
<!-- Android -->
<meta property="al:android:url" content="customschemaurl://fromShare">
<meta property="al:android:package" content="com.mycompany.myappbundleid">
<meta property="al:android:app_name" content="App name">
<!-- iOS -->
<meta property="al:ios:url" content="customschemaurl://fromShare" />
<meta property="al:ios:app_store_id" content="0000000" /> <!-- itunes connect app id, not bundle id -->
<meta property="al:ios:app_name" content="App name" />
<!-- OG Share (url shared) -->
<meta property="og:title" content="some share title"/>
<meta property="og:url" content="http://www.example.com/share.php"/>
<meta property="og:image" content="http://www.example.com/byb-logo.png"/>
<meta property="og:site_name" content="App name"/>
<meta property="og:description"
content="some description text"/>
</head>
<body>
</body>
</html>
这个简单的网页会检测它是Android还是iphone并启动应用程序,如果它是Web浏览器(非移动版),它将重定向到您的网站(如果您有像我这样的多平台应用程序,则可以下载页面),并允许Facebook搜寻器(非移动版) )以访问所需信息以正确调用该应用。
希望能帮助到你..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.