Not able to receive local notification while application is in background and able to receive in forground
<pre><code>didFinishLaunchingWithOptions method

let notificationSettings = UIUserNotificationSettings(
  forTypes: [.Alert, .Badge, .Sound], categories: nil)         
UIApplication.sharedApplication()
  .registerUserNotificationSettings(notificationSettings)
</code></pre>

<p>And in sharedClass </p>

<pre><code> let localNotification = UILocalNotification()
 localNotification.timeZone = NSTimeZone.localTimeZone()
 localNotification.fireDate = getNextDate(NSDate(), duration: "5")
 localNotification.alertBody = "Temp"
 localNotification.alertAction = "OK"

 UIApplication.sharedApplication()
   .scheduleLocalNotification(localNotification)
</code></pre>

<p>I am able to get in foreground but not able to get in background. Anyone have idea about this?</p>