I've been trying to implement the fetch completion block with no luck. Whenever I send an APN, xcode still complains that it's not implemented. Here's my code
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
println("2. User Data", userInfo)
completionHandler(UIBackgroundFetchResult.NewData)
}
and the warning I am getting in the xcode console is this
Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.
Not sure if I am implementing the right syntax here
Remove the println or change it to a NSLog, then try again. Most likely the problem is caused because this method is coming to you in the background and not on the main thread. println is much simpler than NSLog, which is thread-safe and been hardened for years and years.
I had an exact same issue but a totally different solution. The problem of mine is I imported Intercom
so people can chat in-app, and seems like it intercepts the notifications and the didReceiveRemoteNotification
never got called in my AppDelegate
.
I can finally stop banging my head against the wall, hope this can save someone's time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With