xamarin Universal Link无法在iOS上打开应用程序,如何定位问题?

n8ghc7c1  于 2022-12-07  发布在  iOS
关注(0)|答案(1)|浏览(127)

I am trying to implement Universal Links in my app using Xamarin.iOS but it is not working. I have already completed the following steps.

  1. I have uploaded apple-app-site association file on the m.mydomain.com server in the .well-known directory and it is being validated by the apple app search validation tool. I have used the paths ["*", "/"] and verified the team id and bundle id.
  2. I have enable associated domains in the provisioning profile.
  3. I have added applinks:m.mydomain.com as an associated domain.
  4. I have implemented the following methods: ContinueUserActivity, WillContinueUserActivity, UserActivityUpdated, OpenURL
    Even after these steps, the app never opens, instead a webpage opens.
    I am using Xamarin.Forms 4.7 and iOS 15.6 (simulator) & 16 (device)
    Apple App Site Association File:
{
"applinks": {
    "apps": [],
    "details": [
        {
            "appID": "<AppId>",
            "paths": ["*", "/"]
        },
        {
            "appID": "<AppId>",
            "paths": ["*", "/"]
        }
    ]
}

}

wa7juj8i

wa7juj8i1#

请参阅:https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
我觉得你需要改变

"paths": ["*", "/"]

"paths": ["*"]

虽然以上是文档中描述的方式,但我认为以下模式更适合多个应用程序。

{
  "applinks": {
      "details": [
           {
             "appIDs": [ "<appId_app_one>"],
             "comment": "This is for the APP_ONE_NAME iOS App. Based on https://developer.apple.com/forums/thread/649423 for multiple apps",
             "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"
               },
               {
                  "/": "/expert/abc",
                  "comment": "Matches any URL whose path starts with /expert/abc"
               },
               {
                  "/": "/expert/xyz",
                  "comment": "Matches any URL whose path starts with /expert/xyx"
               },
               {
                  "/": "/pwdreset/dret",
                  "comment": "Matches any URL whose path starts with /pwdreset/dret"
               },
               {
                  "/": "/emailverification/dret",
                  "comment": "Matches any URL whose path starts with /emailverification/dret"
               }
             ]
           },
           {
             "appIDs": [ "<appId_app_two>"],
             "comment": "This is for the APP_TWO_NAME iOS App",
             "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"
               },
               {
                  "/": "/pwdreset/mobile",
                  "comment": "Matches any URL whose path starts with /pwdreset/mobile"
               },
               {
                  "/": "/emailverification/mobile",
                  "comment": "Matches any URL whose path starts with /emailverification/mobile"
               }
             ]
           }
       ]
   }
}

相关问题