动态更改应用程序 CFBundleURLScheme plist 条目(编译后)
我正在尝试创建一个 iPhone 应用程序来处理各种 URL 方案,我将通过查询服务器动态确定这些方案。
是否可以通过编程方式注册自定义 url 方案?换句话说,您可以在编译/部署应用程序后更新 CFBundleURLScheme plist 条目吗?
我在其他地方找不到任何这样做的例子,但我也找不到任何明确的理由来说明为什么这是不可能的。
非常感谢。
I'm trying to create an iPhone application that will handle a variety of URL Schemes that I will determine dynamically by querying a server.
Is it possible to register for a custom url scheme programmatically? In other words, can you update the CFBundleURLScheme plist entry after the application has been compiled / deployed?
I haven't been able to find any examples of this being done elsewhere, but nor can I find any definitive reasons why this isn't possible.
Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对不起,没有办法了。您无法以编程方式注册自定义 url 方案。您也无法编辑 Info.plist,应用程序包在 iPhone 上是只读的。
I'm sorry, there is no way. You cannot register custom url schemes programmatically. You also cannot edit your Info.plist, application bundles are read-only on the iPhone.
以下是我为 Swift 解决这个问题的方法:
Here is how I solved it for Swift:
2021 年的新答案
现在可以在使用某些脚本编译应用程序之前编辑 Info.plist。
您可以参考这篇文章:添加/替换URL方案在 Info.plist 中使用 bash 脚本
NEW ANSWER AS OF 2021
It is now possible to edit your Info.plist before compiling your app using some scripts.
You can refer to this post: Add/Replace URL Scheme in Info.plist using bash script