From 1f3c38faf43fec7145ff81561112bc0cefa56ce1 Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Thu, 5 Jan 2017 10:27:35 -0500 Subject: [PATCH] Fix iOS crash on startup due to wrong thread (#245) Error: ``` Assertion failure in -[GIPReachability startWithCompletionHandler:] 'NSInternalInconsistencyException', reason: 'GIPReachability should be used from the main thread' ``` Fixes #233 --- ios/RNFIRMesssaging.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ios/RNFIRMesssaging.m b/ios/RNFIRMesssaging.m index 208e8bf..c9066fd 100644 --- a/ios/RNFIRMesssaging.m +++ b/ios/RNFIRMesssaging.m @@ -160,7 +160,9 @@ RCT_EXPORT_MODULE() name:FIRMessagingSendSuccessNotification object:nil]; // For iOS 10 data message (sent via FCM) - [[FIRMessaging messaging] setRemoteMessageDelegate:self]; + dispatch_async(dispatch_get_main_queue(), ^{ + [[FIRMessaging messaging] setRemoteMessageDelegate:self]; + }); } - (void)connectToFCM -- 2.26.2