I'm using the Firebase console in testing to receive a notification in my iOS. At first it says that I'm connected to Firebase and I receive the Message ID but then I'm having an error Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called. and Unable to connect to FCM. Error Domain=com.google.fcm Code=2001 "(null)" How can I solve this?
Here is my code for didReceiveRemoteNotification
// [START receive_message]
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// If you are receiving a notification message while your app is in the background,
// this callback will not be fired till the user taps on the notification launching the application.
// TODO: Handle data of notification
// Print message ID.
NSLog(@"Message ID: %@", userInfo[@"gcm.message_id"]);
// Pring full message.
NSLog(@"%@", userInfo);
}
// [END receive_message]
Try adding:
completionHandler(UIBackgroundFetchResultNoData);
At the end of your didReceiveRemoteNotification method.
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