我有一个使用NativeScript + Angular构建的应用程序。
我必须共享一个链接(通用网址,可以打开我的应用程序)。因此,在共享按钮上录音,应用程序共享页面在里面的网址。然后,查看链接并点击它的用户应该使用(相同)安装的应用程序直接打开。
在清单文件中的以下配置下,这在Android上运行得很好:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="www.test.com" />
<data android:scheme="https" />
</intent-filter>我正在使用SocialShare插件来共享url:
share() {
let url = this.router.url;
SocialShare.shareUrl("http://www.test.com" + url, "http://www.test.com" + url);
}但是在iOS上,这个链接是在Safari上打开的。我已经用下面的配置更新了我的info.plist文件
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>mytestapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>http://www.test.com</string>
</array>
</dict>我尝试使用自定义url方案,类似于info.plist模式上的'test‘,然后我尝试共享以下url: test://my_定制_routing,发现它工作正常。
如果恢复到通用的url计划,我遗漏了什么呢?
发布于 2019-06-28 17:57:55
直到v9.0,iOS才使用基于通用(http / https)的url方案。大多数应用程序都使用SmartBanners,或者可能会托管一段JavaScript代码,这些代码将用户从Safari页面重定向到应用程序。
虽然iOS现在开始支持通用的url方案,但使用它们并不像Android那么容易。只需要再走几步,
添加对通用链接的支持很容易。您需要采取以下三个步骤:
您可以在设备上测试通用链接。
更详细的说明可以在苹果官方文档上找到。
https://stackoverflow.com/questions/56810989
复制相似问题