Categories
appdelegate apple-push-notifications ios swift

Why is didReceiveRemoteNotification not called but didReceiveRemoteNotification:fetchCompletionHandler called when my app is in the foreground?

If I override

override func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
println("hey)
}

I successfully have the method called with the app in the foreground when I send a push notification.

If I override

override func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
println("hey")
}

I don’t get any call to the method when sending a notification with the app in the foreground. Why does the first one work, but the second one doesn’t when the app is in the foreground?

Note that I am only implementing one of these at a time. Not both at the same time.