Created
May 29, 2015 11:56
-
-
Save toshi0383/fc40ec85e26f4c25a673 to your computer and use it in GitHub Desktop.
MacアプリでiOSアプリみたいにURL Scheme起動すんのってどうやんの?を調べてみた ref: http://qiita.com/toshi0383/items/94abad5667f84b773ba9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func applicationDidFinishLaunching(aNotification: NSNotification) { | |
| // Insert code here to initialize your application | |
| var appleEventManager:NSAppleEventManager = NSAppleEventManager.sharedAppleEventManager() | |
| appleEventManager.setEventHandler(self, andSelector: "handleGetURLEvent:replyEvent:", forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL)) | |
| var appUrl = NSBundle.mainBundle().bundleURL.URLByAppendingPathComponent("", isDirectory: true) | |
| var a:Boolean = 0 // true | |
| var status = LSRegisterURL(appUrl as CFURL!, a) | |
| } | |
| func handleGetURLEvent(event: NSAppleEventDescriptor?, replyEvent: NSAppleEventDescriptor?) { | |
| println("yay"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment