URL标识符和URL方案 [英] URL identifier and URL scheme

查看:338
本文介绍了URL标识符和URL方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS中,您可以设置网址方案,以便其他应用可以启动您或将数据传递给您。什么是URL标识符?除了指定URL方案之外,它似乎没有被使用。

In iOS you can set up URL scheme so other apps can launch you or pass data to you. What's the URL Identifier for? It doesn't seem to be used anywhere other than when you specify URL Schemes.

此外,当手机上存在重复的URL方案时会发生什么?

Also, what happen when there is duplicate URL schemes on the phone?

推荐答案

根据 Apple文档他们没有提供有关标识符的详细信息及其原因需要或在何处使用。他们只说它应该是唯一的:

According to Apple documentation they don't give much info about the identifier and why it is needed or where it is used. They only say that it should be unique:


包含URL方案的抽象名称的字符串。为确保唯一性,建议您指定反向DNS样式的标识符,例如com.acme.myscheme。
您指定的字符串也用作应用程序的InfoPlist.strings文件中的键。密钥的值是人类可读的方案名称。

A string containing the abstract name of the URL scheme. To ensure uniqueness, it is recommended that you specify a reverse-DNS style of identifier, for example, com.acme.myscheme. The string you specify is also used as a key in your app’s InfoPlist.strings file. The value of the key is the human-readable scheme name.

此外,如果多个应用程序指定相同的网址方案,则结果是不可预测的:

Also if more than one app specify the same url scheme, then the outcome is unpredictable:


注意:如果多个第三方应用程序注册处理相同的URL方案,则目前没有进程确定将给予该计划的应用程序。

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 experience taught me that the app who first registered that scheme will be opened, but this may be wrong.

这篇关于URL标识符和URL方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆