Here is the code that I have used to receive push Notification when app in foreground
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, willPresentNotification notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void)
{
completionHandler([UNNotificationPresentationOptions.Alert,UNNotificationPresentationOptions.Sound,UNNotificationPresentationOptions.Badge])
}
But my problem is that my notification contains [NSObject : AnyObject] values. How to receive like background notification
Add this code in AppDelegate.swift file.