“Safari无法打开页面,因为地址无效”在访问已卸载应用程序的分支链接时出现

我正在将一个应用程序与Branch.io集成,并在Safari中遇到了一个问题(我在iOS 11上测试了这个问题,但问题也可能出现在其他版本上)。

基本上,如果我安装了我的应用程序并在Safari或Chrome中打开一个快速链接,一切正常,我得到提示打开应用程序中的链接。 但是,如果我卸载应用程序并点击Safari中的链接,我会收到以下消息:

Safar上的错误消息

当我点击确定按钮时,我会收到打开Appstore的提示,这是所需的行为。 有没有办法阻止“Safari无法打开页面因为地址无效”消息出现? 我尝试在没有安装应用程序的情况下打开Chrome中的链接,一切正常。

我已经使用了官方设置指南并输入了我的URI方案但禁用了Universal Links,因为我自己正在处理这些问题。 这会导致这个问题吗?

来自Branch.io的 Aaron

您可能会收到此错误,因为当未安装应用时,Branch正尝试通过URI方案启动您的应用。 从iOS 9.2开始,Apple不再正式支持用于深层链接的URI方案,强烈建议开发人员实施Universal Links以获得iOS上的等效function。

具体来说,自定义URI方案存在明显的缺点,最明显的是无法轻松处理这两种情况:

  • 未安装应用程序时。
  • 当多个应用尝试声明myapp://时。

因此,我们建议您在分支仪表板中启用通用链接。 您需要做的就是提供您的包ID和应用前缀,Branch将为您托管AASA文件。

我也遇到了这个问题,但我发现按照分支测试应用程序测试部分的说明,我可以在没有Safari警告的情况下打开应用程序。

https://github.com/BranchMetrics/ios-branch-deep-linking/tree/master/Branch-TestBed-Swift#test

1. If the app was installed on the test device already: * Delete the app from the device * Clear Safari web content, history and cookies (Settings > Safari > Clear History and Website Data) * Reset the device's IDFA (Settings > Privacy > Advertising > Reset Advertising Identifier...) 2. Create a Marketing link from the Branch dashboard 3. Paste the link into Notes on an iPhone 4. Tap the link - you will get redirected to the web page 5. ...