如何在 iOS Swift 中添加 url 深层链接

How to add url deeplink in iOS Swift

如何使用 swift.

在 iOS 中添加深层链接(url,如 https://www.example.com

如果我在其中输入 url,plist 中的方案将不起作用。

你可以查看附件中的plist截图。

只是为了精确:

如果您需要有关 Apple 文档的更多文档,请使用正确的技术名称。

如果您使用 url 以不同于 http 的模式开头(例如 fb:// 对于 FB)不是 LINK,是 "custom" url.

无论如何使用:自定义 url 并查看:

https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html

您正在尝试为 Apple 已为 Safari 保留的 URI 方案 https 注册您的应用程序,因此您将无法使用它。

选项 1:自定义 URI 方案

您必须想出一个自定义 URI 方案,例如 customURI://www.domain.com

缺点:如果用户在没有安装应用程序的情况下点击此 link。 iOS 将显示该用户和错误。

选项2:Universal链接

Apple 在 iOS 9 中推出了 Universal Links,使开发人员能够将他们的 http link 与他们的应用相关联。这需要您在您的域上托管您自己的 AASA 文件,以便您的域与您的应用程序 ID 相关联。

选项 3:Branch.io

Branch will actually bundle up Universal Links and URI schemes and use them appropriately when necessary. They also perform deferred deep linking。他们将为您托管您的 AASA 文件,但您的应用域必须是 https://*.app.link 或您拥有的域的某个专用子域。