This is the next question. How to check the launch of the Options in Swift? - I got the application to start without crashing, but I cannot seem to detect correctly when the application starts from the notification, and the usual start.
I create my UILocalNotification as follows:
// set up a frequently recurring notification here just for testing... var fast = UILocalNotification() fast.fireDate = NSDate(timeIntervalSinceNow: 15) fast.alertBody = "Alert Message" fast.timeZone = NSTimeZone.localTimeZone() fast.repeatInterval = NSCalendarUnit.CalendarUnitMinute fast.userInfo = ["Important":"Data"] UIApplication.sharedApplication().scheduleLocalNotification(fast)
And this is my code for trying to process when the application is launched from UILocalNotification.
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { if var launch = launchOptions { if var key = launch.objectForKey(UIApplicationLaunchOptionsLocalNotificationKey) {
If my application is associated with the background and I click on the warning field, the action I want to run is performed correctly, so I know that at least I can get one path. The problem here is the full launch of the application from the notification.
source share