0

我試圖將react-native-firebase集成到一個簡單的應用程序。我遵循這裏提到的步驟http://invertase.io/react-native-firebase/#/installation-ios?id=_11-initialisation。我配置了一切,運行應用程序,但是當我從上面提到的錯誤消息FCM應用崩潰得到通知,並將其在RNFirebaseMessaging.m行號406, 的代碼看起來像這樣響應本機應用程序崩潰收到錯誤消息「沒有completionHandlerId完成處理程序:<Id>」

RCT_EXPORT_METHOD(finishRemoteNotification: (NSString *)completionHandlerId fetchResult:(UIBackgroundFetchResult)result) { 
    RCTRemoteNotificationCallback completionHandler = self.notificationCallbacks[completionHandlerId]; 
    if (!completionHandler) { 
     RCTLogError(@"There is no completion handler with completionHandlerId: %@", completionHandlerId); 
     return; 
    } 
    completionHandler(result); 
    [self.notificationCallbacks removeObjectForKey:completionHandlerId]; 
} 

我做打印情況completionHandler字典在調用此方法之前具有數據,但此方法稱爲completionHandler時爲零。 有沒有人遇到過同樣的問題?

我正在使用反應原生版本0.47.0和react-native-firebase 2.0.5 PS:應用程序每次收到遠程通知時崩潰。

+0

我可以建議在github上回購了RNFirebase,開心那邊看看它做的問題。 – Salakar

回答

1

書面here

的問題是,你可能訂閱2(或更多)的onMessage聽衆。

當您調用onMessage時,它將返回取消訂閱方法,您可以稍後調用,如果需要,然後再次訂閱後。

而且,他們目前正在Messaging/FCM overhaul

// subscribe 
 
const unsubscribe = firebase.messaging().onMessage((url) => { 
 
    // ... 
 
}); 
 

 
// unsubscribe 
 
unsubscribe();

相關問題