如何以编程方式注册自定义URL方案? [英] How to programmatically register a custom URL scheme?

查看:152
本文介绍了如何以编程方式注册自定义URL方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程式执行时,是否可以新增/移除自订网址架构?现在,CFBundleURLSchemes属性在Info.plist中设置。

Is it possible to add/remove custom URL schemes for my application while it's running? Right now the CFBundleURLSchemes property is set in Info.plist.

推荐答案

根据这个讨论Cocoa Dev 的答案是没有,自定义URL方案不能以程序方式注册。您必须在 Info.plist 中指定它们。 (但使用 LSRegisterURL ,您可以 要求Launch Services重新载入应用程式的 Info.plist 如果你以编程方式改变它,但是这是丑陋。)。

According to this discussion on Cocoa Dev the answer is no, custom URL schemes can't be registered programmatically. You must specify them in Info.plist. (but using LSRegisterURL, you can ask Launch Services to reload your application's Info.plist if you programmatically change it. But that's ugly.).

这篇关于如何以编程方式注册自定义URL方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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