didFinishLaunchingWithOptions method
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Alert, .Badge, .Sound], categories: nil)
UIApplication.sharedApplication()
.registerUserNotificationSettings(notificationSettings)
And in sharedClass
let localNotification = UILocalNotification()
localNotification.timeZone = NSTimeZone.localTimeZone()
localNotification.fireDate = getNextDate(NSDate(), duration: "5")
localNotification.alertBody = "Temp"
localNotification.alertAction = "OK"
UIApplication.sharedApplication()
.scheduleLocalNotification(localNotification)
I am able to get in foreground but not able to get in background. Anyone have idea about this?