I'm trying to launch a MacOSX app from a 开发者_StackOverflow社区website and pass an authentication token from the web server. I'm trying to do something like myNewURLScheme://myauthtoken (similar to the iTunes itms:// URLs) but this doesn't seem to work. (Admittedly, I'm probably doing it wrong.)
- Is this the best way to do it? (If not what is?)
- How is this supposed to work? I've tried looking at "Installing a Get URL Handler" in the docs: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html, but it doesn't seem to work.
Thanks!
See here for how to get an application to have its own url scheme. You'll want to follow steps 1 thru 3 of georgebrock's post. I'm not sure how you'll get a website to pass the url to the computer though. The easiest way I can think of is to have Mail.app running on the mac and set up a mail rule. The rule can be set up to run an applescript... the applescript launches the application.
http://www.xmldatabases.org/WK/blog/1154_Handling_URL_schemes_in_Cocoa.item
This is the only one that really worked for me! Flawless.
精彩评论