首页 > 解决方案 > 在 iOS 14 上使用通用链接

问题描述

我正在创建一个应用程序,我想使用Universal Links. 我已经关注了,Apple Documentation但是当我打开我的时,我URL看不到将浏览器与我的应用程序链接的按钮。这里有一些细节:

这是我的关联域列表

这是我的 Project.entitlements 中的关联域列表

这是我需要使用我的应用处理的 URL

在我的网站中,我看不到处理我的应用程序的按钮

如果我在 mydomain.mx:81/apple-app-site-association 上,它会下载并且不会像 https://facebook.com/apple-app-site-association 那样显示

苹果应用程序站点关联文件

{
   "applinks":{
      "details":[
         {
            "appIDs":[
               "[TEAM-ID].[BUNDLE-ID]"
            ],
            "components":[
               {
                  "#":"no_universal_links",
                  "exclude":true,
                  "comment":"Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
               },
               {
                  "/":"/store",
                  "comment":"Matches any URL whose path starts with /store"
               },
               {
                  "/":"/product",
                  "comment":"Matches any URL whose path starts with /product"
               },
               {
                  "/":"/category",
                  "comment":"Matches any URL whose path starts with /category"
               }
            ]
         }
      ]
   },
   "webcredentials":{
      "apps":[
         "[TEAM-ID].[BUNDLE-ID]"
      ]
   }
}

AppDelegate.swift

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        
        print("Handled it!")
        guard let url = userActivity.webpageURL else {return false}
        print(url)
        
        return false
    }

附言。我没有显示我的域名,因为它是机密信息

非常感谢大家的支持

标签: iosios14ios-universal-linksuniversal-link

解决方案


推荐阅读