iOS 如何处理 URL 方案重复?

发布于 2024-10-18 16:43:12 字数 45 浏览 15 评论 0原文

如果另外 2 个应用程序注册相同的 url 方案,iOS 如何处理这个问题?

If 2 other app register same url scheme, how iOS handle this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

原来是傀儡 2024-10-25 16:43:12

iOS 文档内容如下:

注意:如果多个第三方应用程序注册来处理相同的 URL 方案,则当前没有流程可确定哪个应用程序将获得该方案。

如果有两个应用程序注册了一个 URL 方案,则操作系统的行为是未定义的,因此您应该尝试定义一个特定于您的应用程序的处理程序以避免这种情况(例如 awesomeMapsApp:// 而不是 <代码>地图://)。

The iOS Documentation reads:

Note: If more than one third-party app registers to handle the same URL scheme, there is currently no process for determining which app will be given that scheme.

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 of maps://).

挽容 2024-10-25 16:43:12

事实上这可能真的有问题。例如,直到 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 handles PayPal schemes so that if your app tries to open PayPal (with all the security nonce etc. within the call) it launches Grabb instead, and you can do nothing about it. Even with the openURL alertView added in iOS 9, it can still be a big security issue.

桜花祭 2024-10-25 16:43:12

这是我测试过的:

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.

注定孤独终老 2024-10-25 16:43:12

它将呈现一个 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文