3

テストで Firebase コンソールを使用して、iOS で通知を受信して​​います。最初は、Firebase に接続されていると表示され、メッセージ ID を受け取りましたが、エラーが発生Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.し、Unable to connect to FCM. Error Domain=com.google.fcm Code=2001 "(null)" どうすれば解決できますか?

これが 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]
4

1 に答える 1

2

追加してみてください:

completionHandler(UIBackgroundFetchResultNoData);

didReceiveRemoteNotification メソッドの最後。

于 2016-06-17T15:47:45.053 に答える