Skip to content

Instantly share code, notes, and snippets.

@toshi0383
Created May 29, 2015 11:56
Show Gist options
  • Select an option

  • Save toshi0383/fc40ec85e26f4c25a673 to your computer and use it in GitHub Desktop.

Select an option

Save toshi0383/fc40ec85e26f4c25a673 to your computer and use it in GitHub Desktop.
MacアプリでiOSアプリみたいにURL Scheme起動すんのってどうやんの?を調べてみた ref: http://qiita.com/toshi0383/items/94abad5667f84b773ba9
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