开发者

Custom URL Scheme for CommandLine Application

开发者 https://www.devze.com 2023-04-10 04:12 出处:网络
Is it possible for a Xcode \"CommandLine application\" (written in C++) to be launched with a custom URL scheme? I know you 开发者_运维百科can do this with a Cocoa application, but would it be possibl

Is it possible for a Xcode "CommandLine application" (written in C++) to be launched with a custom URL scheme? I know you 开发者_运维百科can do this with a Cocoa application, but would it be possible with C++?


It doesn't matter what language you use; it is not possible to bind a URL scheme to a command-line tool. The opening of URLs happens by an Apple Event to the application, not directly running the program with the URL (particularly since it may already be running, but this is true whether it is or not).


You could try embedding an Info.plist in the executable to give it a bundle identifier and declare its support for the URL scheme, which may enable you to bind the URL scheme to the executable. I would still be surprised if opening such URLs worked, but it's worth a shot.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号