我有一个支持通用链接的应用程序,它目前在应用程序商店中.
假设它支持域www.example.com,因此可以通过此方便地打开通用链接.我们将在相关域中提供applinks:www.example.com.
解决方法
要在两个不同的应用上支持使用单个域的通用链接,您需要在现有的apple-app-site-association文件中进行更改,网址为https:// {domain} / apple-app-site-association.
对于单一应用支持
对于单个应用程序支持,它看起来像这样
{ "applinks": { "apps": [],"details": [ { "appID": "1234ABCDE.com.domain.myapp","paths": ["*"] } ] } }
对于多应用程序支持
对于多应用程序支持,您需要在apple-app-site-association中的applinks的详细信息数组中添加一个键值对.它看起来像这样
{ "applinks": { "apps": [],"details": [ { "appID": "1234ABCDE.com.domain.myApp","paths": ["*"] },{ "appID": "1234ABCDE.com.domain.mySecondApp",{ "appID": "1234ABCDE.com.domain.myThirdApp","paths": ["*"] } ] } }
apple-app-site-association文件的一般格式
该文件如下所示:
{ "applinks": { "apps": [ ],"details": [ { "appID": "{app_prefix}.{app_identifier}","paths": [ "/path/to/content","/path/to/other/*","NOT /path/to/exclude" ] },{ "appID": "TeamID.BundleID2","paths": [ "*" ] } ] } }
参考
How to support Universal Links in iOS App and setup server for it?