iOS 如何处理 URL 方案重复?
如果另外 2 个应用程序注册相同的 url 方案,iOS 如何处理这个问题?
If 2 other app register same url scheme, how iOS handle this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如果另外 2 个应用程序注册相同的 url 方案,iOS 如何处理这个问题?
If 2 other app register same url scheme, how iOS handle this?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
iOS 文档内容如下:
如果有两个应用程序注册了一个 URL 方案,则操作系统的行为是未定义的,因此您应该尝试定义一个特定于您的应用程序的处理程序以避免这种情况(例如
awesomeMapsApp://
而不是 <代码>地图://)。The iOS Documentation reads:
The OSs behaviour is undefined if there are two apps registered for an URL scheme, therefore you should try to define a handler that is specific for your app to avoid this situation (e.g.
awesomeMapsApp://
instead ofmaps://
).事实上这可能真的有问题。例如,直到 2016 年 3 月,一款名为
Grabb
的应用程序会处理PayPal
方案,因此,如果您的应用程序尝试打开PayPal
(具有所有安全性),调用中的随机数等)它会启动Grabb
,而您对此无能为力。即使 iOS 9 中添加了openURL AlertView
,它仍然可能是一个很大的安全问题。Actually it can be really problematic. For example, til' March 2016, an app called
Grabb
handlesPayPal
schemes so that if your app tries to openPayPal
(with all the security nonce etc. within the call) it launchesGrabb
instead, and you can do nothing about it. Even with theopenURL alertView
added in iOS 9, it can still be a big security issue.这是我测试过的:
iOS 5:将选择第一个安装的应用程序。如果您删除第一个安装的应用程序,则其他应用程序将不会启动,除非您再次安装。
iOS 6:将选择最新安装的应用程序。如果您删除最近安装的应用程序,则将选择以前安装的应用程序。
Here is what I have tested:
iOS 5: the first installed app will be chosen. If you delete first installed app, then the others will not launch unless you install again.
iOS 6: the lastest installed app will be chosen. If you delete the lastest installed app, then the previous installed app will be chosen.
它将呈现一个 UIActionSheet 视图,允许用户选择要启动的应用程序(处理 .doc 文件的应用程序就是一个很好的例子)。这就是您指定的图标的使用位置 - 当向用户显示时,在操作表按钮上
It will present an UIActionSheet view allowing the user to choose which app to launch (good example are apps that handle .doc files). That's where the icon you specify is used - on the action sheet buttons when it's shown to the user