After installing react-native-firebase on a FRESH init of a react native app, the app on iOS crashes.
It builds fine, but crashes immediately on opening.
EDIT: The same happens with your react-native-firebase-starter...
Describe your issue here
ios/Podfile:# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'app' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# # Pods for app
pod 'Firebase/Core', '~> 5.20.1'
target 'appTests' do
inherit! :search_paths
# Pods for testing
end
end
AppDelegate.m:/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"app"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
Click To Expand
**`react-native info` output:**
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
Memory: 85.47 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.1.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 23, 25, 26, 28
Build Tools: 22.0.1, 23.0.1, 23.0.3, 25.0.2, 26.0.1, 26.0.3, 28.0.1, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.8 => 0.59.8
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
- **Platform that you're experiencing the issue on**:
- [x] iOS
- [ ] Android
- [ ] **iOS** but have not tested behavior on Android
- [ ] **Android** but have not tested behavior on iOS
- [ ] Both
- **`Firebase` module(s) you're using that has the issue:**
- `base module`
- **Are you using `TypeScript`?**
- `N`
How your application is crashing? I got a black screen after I call firebase.initializeApp() with second argument
If you guys are doing a fresh install on a fresh app, don't. Use the react-native-firebase-starter repo. If for learning purposes you'd like to do a fresh start, still use the starter, but then carefully compare things. This is undoubtedly an installation or linking or configuration problem.
I found mine. I used a wrong firebase app key while initializing firebase
I am having same issue. Application is crashing with fresh installation (on permission request) with iOS.
@yusufkinatas @mikehardy - Yes, I have got blank screen and crashed. It showing first time only, After accept, it works normally (without any issue).
"react-native": "0.59.1"
"react-native-firebase": "^5.3.1"

@codoffer You can debug with xcode. Run your app from xcode. When the app crashes, look at xcode logs.
This is usually what happens when you don't include the right key in your plist with description of the permission you are asking for.
@mikehardy the starter app is also crashing.
If I remove this line [FIRApp configure];, the app starts.. so I can conclude that it's the initialisation of firebase that's causing the crash..
My google services info plist file is in place.
I see this in the logs:
<Error>: assertion failed: 18D109 16E226: libxpc.dylib + 80700 [B558DAD6-9E08-3208-B352-1CA4137B67C8]: 0x7d
built and ran through xcode and got the following output:
2019-05-19 16:16:56.342789+0200 app[69392:13595302] 5.20.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
2019-05-19 16:16:56.343142+0200 app[69392:13595302] 5.20.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
2019-05-19 16:16:56.386675+0200 app[69392:13594653] *** Terminating app due to uncaught exception 'com.firebase.core', reason: '`[FIRApp configure];` (`FirebaseApp.configure()` in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109b6d6fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000107e6fac5 objc_exception_throw + 48
2 CoreFoundation 0x0000000109b6d555 +[NSException raise:format:] + 197
3 app 0x0000000105047232 +[FIRApp configure] + 562
4 app 0x0000000104ff03d0 -[AppDelegate application:didFinishLaunchingWithOptions:] + 96
5 UIKitCore 0x000000011761f311 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
6 UIKitCore 0x0000000117620cad -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3932
7 UIKitCore 0x00000001176260c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
8 UIKitCore 0x0000000116e6b6d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
9 UIKitCore 0x0000000116e73fce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
10 UIKitCore 0x0000000116e6b2ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
11 UIKitCore 0x0000000116e6bc48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
12 UIKitCore 0x0000000116e69fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
13 UIKitCore 0x0000000116e69c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
14 UIKitCore 0x0000000116e6e9b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
15 UIKitCore 0x0000000116e6f610 _performActionsWithDelayForTransitionContext + 100
16 UIKitCore 0x0000000116e6e71d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
17 UIKitCore 0x0000000116e736d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
18 UIKitCore 0x00000001176249a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
19 UIKitCore 0x00000001171dbdfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
20 FrontBoardServices 0x0000000116135125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
21 FrontBoardServices 0x000000011613eed6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
22 FrontBoardServices 0x000000011613e700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
23 libdispatch.dylib 0x000000010c1cddb5 _dispatch_client_callout + 8
24 libdispatch.dylib 0x000000010c1d12ba _dispatch_block_invoke_direct + 300
25 FrontBoardServices 0x0000000116170146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
26 FrontBoardServices 0x000000011616fdfe -[FBSSerialQueue _performNext] + 451
27 FrontBoardServices 0x0000000116170393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
28 CoreFoundation 0x0000000109ad4be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x0000000109ad4463 __CFRunLoopDoSources0 + 243
30 CoreFoundation 0x0000000109aceb1f __CFRunLoopRun + 1231
31 CoreFoundation 0x0000000109ace302 CFRunLoopRunSpecific + 626
32 GraphicsServices 0x000000010d4ef2fe GSEventRunModal + 65
33 UIKitCore 0x0000000117627ba2 UIApplicationMain + 140
34 app 0x0000000104ff08c0 main + 112
35 libdyld.dylib 0x000000010c242541 start + 1
36 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
services plist not found, but it is there in the correct place.
Well, here's the solution: https://github.com/invertase/react-native-firebase/issues/1499#issuecomment-431543621
It would be good to mention in the documentation that the file should be added to the iOS project using xcode and not simply copying it via terminal or finder.
I believe it is possible to simply copy it, that's what I did, but it has to be in the exactly correct spot, otherwise you have to add it to XCode so the project has a reference to the correct spot. I never had to add them to XCode until I implemented multiple release streams (dev, test, stage, prod) to my project, with correspondingly seperate firebase project back-ends - then I had to add them to the various targets, but otherwise I think it was just a location / placement problem
I did the same as in drag and drop google-serviceinfo.plist to my root folder, but still it didn't workout.
Yeah - my previous comment from May seems incorrect when I look back on it. As I worked to build a reproducible demo I discovered that it only worked if I used Xcode to actually add the file - and I left a comment even for the demo https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh#L51 - since it is the one part that can't be done with just text editing
Open Xcode and open AppDelagate.m
import this
#import
add in starting of didFinishLaunchingWithOptions [FIRApp configure];
for example
@implementation AppDelegate
Most helpful comment
Well, here's the solution: https://github.com/invertase/react-native-firebase/issues/1499#issuecomment-431543621