简体   繁体   中英

Opening a carbon c++ program from a custom url on OSx

I have been able to set the plist for my project to open the project with a given url. However, I can't get it to pass params to the application (custom urls are built based on the user)

Is there a way to pass the params as command line arguments?

the scheme is essentially url:userid

I need to be able to get the user id in the application. Is there a way to do this? I know with cocoa you can create an app delegate to handle this but I need a carbon way to do it.

Thanks in advance!

Install an Apple Event handler to recognize URLs (both the suite and the event name have the same four-character code, 'GURL').

The event's direct object is a URL string. I would expect that string to contain the entire original URL, including any parameters that were encoded into it (eg if your custom scheme was xyz://some/data?param1=abc&param2=def , you should receive all of that).

Another important step is to register as a handler for that URL type in your Info.plist file. Read up on CFBundleURLTypes for more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM