How to programmatically register a custom URL scheme?

前端 未结 2 1216
遥遥无期
遥遥无期 2020-12-17 21:52

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.

2条回答
  •  佛祖请我去吃肉
    2020-12-17 22:42

    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.).

提交回复
热议问题