[英]Cannot receive notification in iOS using Firebase
我在測試中使用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)"
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]
嘗試添加:
completionHandler(UIBackgroundFetchResultNoData);
在didReceiveRemoteNotification方法的最后。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.