My Application opens fine using the URL Scheme when it is open or running in the background, but if I quit the app, (not running in background or foreground) and then try to open it using the URL Scheme, it crashes immediately.
Code to OpenURL from Extension:
var url: NSURL = NSURL(string: "lifeguard://emergency")!
self.extensionContext?.openURL(url, completionHandler: nil)
Code to handle URL:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
if (url.host == "emergency") {
NSNotificationCenter.defaultCenter().postNotificationName("emergency", object: nil)
}
return true
}