Universal Link可以在Safari浏览器中使用,但不能在Chrome中使用

watbbzwu  于 12个月前  发布在  Go
关注(0)|答案(1)|浏览(86)

我正在测试IOS 15.5IOS16.4.1

1.将代码添加到Info.plist中,然后

<key>CFBundleURLName</key>
    <string> Bundle ID </string>
    <key>CFBundleURLSchemes</key>
    <array>
        <string> myScheme </string>
    </array>

2.添加关联域名
3.制作AASA文件并上传服务器(路径:.well-known/applep-app-site-association)

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "<TeamID>.<Bundle ID>",
        "paths": [ "/test/connect.asp" ]
      }
    ]
  }
}

这样,通用链接在safari浏览器中正常运行。
但在Chrome浏览器中不起作用。我不知道是否有一个设置,需要添加或如果Chrome不支持通用链接了,谢谢。

mpbci0fu

mpbci0fu1#

apple不再为safari以外的浏览器提供universal link
所以我实现了url shemeuniversial link。问题中写了universial link,所以请参考问题。

1.注册url方案

  • xcode -> project -> target -> info -> URL Types。

2. sheme处理

let url = URL(string: "yourUrlSheme:Vacation?index=1")

UIApplication.shared.open(url!) { (result) in
    if result {
       // The URL was delivered successfully!
    }
}

请参阅下面的文章了解详细信息。
https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app

相关问题