Hey guys, working like a bomb on Android but I get this error on iOS. I did the react-native link react-native-firebase way but wondering if I missed anything on iOS. It seems like I followed the steps correctly.
2017-03-18 23:29:35.622 wishlizt[2927:191978] Setting up RNFirebase instance
2017-03-18 23:29:35.861 wishlizt[2927] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization. Read more: https://goo.gl/ctyzm8.
2017-03-18 23:29:35.865 wishlizt[2927] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization. Read more: https://goo.gl/ctyzm8.
Thank you Ehesp, that was exactly it. Can you explain why I missed that? I just looked through the docs again and can't pick it up.
@hugopretorius72 we'll get this added to the docs, thanks for the report :)
@Ehesp the links are not working, I have come across the same problem , I didn't find a way to solve it
It was working fine up until I tried customizing the LaunchScreen and now this appears and the app is stuck at splashscreen. it works fine on android
Could not locate configuration file: 'GoogleService-Info.plist'.
2018-01-04 23:27:39.651812+0530 messagingapp[345:42382] [Firebase/Core][I-COR000005] No app has been configured yet.
2018-01-04 23:27:39.905201+0530 messagingapp[345:42280] * 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/.'
I did the react-native link react-native-firebase way but wondering if I missed anything on iOS. It seems like I followed the steps correctly.Anybody help
@ShivaPrabhagar it seems you have't added the GoogleService-Info.plist file?
The link below fixed it for me! I have no knowledge on iOS development, but somehow the plst needs to be added this way!
https://github.com/firebase/quickstart-ios/issues/5#issuecomment-333264355
(I'm actually on Flutter, but I guess this applies here too)
Did you find any solution ? I am stuck, I have been through the set up twice on React native and Xcode and I still don't get it ...
@robinlietar clone this repo and run this to prove to yourself (and demonstrate) it can work https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh
I have installed the react-native-firebase package and I've followed the instructions. I've added [FIRApp configure];
to AppDelegate.m. I still get this error in the xcode debug area:
app[27670:9969184] 7.1.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
Altough, my code seem to work, so it's not really an issue I think? But it's weird I still get this error.
If you can reproduce it with the demo script above please let me know
Currently experiencing this with ios, I followed everything here https://rnfirebase.io/ but it didn't work...
Changing this:
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
into this:
[FIRApp configure];
makes it work...
If you can reproduce it with the demo script above please let me know
If you can reproduce it with the demo script above please let me know
I think your script is doing more than what the install instruction is saying.
I think your script is doing more than what the install instruction is saying.
@aprilmintacpineda we are programmers, assertions without proof have no value.
Be specific.
@mikehardy Here's the repro https://github.com/aprilmintacpineda/repro-rn-firebase-10 sorry that I did not use your script, it's doing copy-paste on files which may have undergone modifications I am not aware of.
It's more reasonable to follow the instructions stated on the docs, after all, everyone will look at the doc when they're using a library, nobody would say:
Hey, I want to use react-native-firebase, I'll ask @mikehardy for a script
Please note I work on the docs, and the script just reproduces the docs. I don't understand why you want help but don't follow a helpers instructions :shrug:
I didn't say that I don't want to follow your instructions, please don't put words in my mouth.
What I said is: I followed exactly what the docs said I was able to reproduce it.
If we can't reproduce it when using your demo repo with script, then isn't that saying "something is different in that repo"
Please look at the repo that I made, I tried to make it as detailed as possible, I also attached the diff when the app was first initialize vs when the I added the firebase and reproduce the issue.
Ahhh, I think I know why this happens.
I think this is expected behavior as per the definition of FIRApp.defaultApp
, I saw the following:
+ (FIRApp *)defaultApp {
if (sDefaultApp) {
return sDefaultApp;
}
FIRLogError(kFIRLoggerCore, @"I-COR000003",
@"The default Firebase app has not yet been "
@"configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your "
@"application initialization. Read more: https://goo.gl/ctyzm8.");
return nil;
}
So it will ALWAYS appear on the first launch of the app, if this is the case, then I think this is worth noting on the documentation so noobs like me (and maybe others who aren't noobs as well) don't get confused about it.
Do you have a link to that code? Not sure where you saw it but I'm interested in the context in order to verify the assertion
So it will ALWAYS appear on the first launch of the app
What experimental results to you have that are consistent with this hypothesis? Have you definitely seen that every time the app is uninstalled completely and reinstalled, you see the referenced error message, but on all subsequent launches not broken by an uninstall, you do not see the warning?
I didn't say that I don't want to follow your instructions, please don't put words in my mouth.
What I said is: I followed exactly what the docs said I was able to reproduce it.
What I have instructed is this:
If you can reproduce it with the demo script above please let me know
You do not do that
If we can't reproduce it when using your demo repo with script, then isn't that saying "something is different in that repo"
It would point out that my script, which was constructed by following the instructions which I edited at the same time, has somehow grown apart from the instructions, and one or the other needs correction. The docs and the script should have 100% fidelity, and I assert they still do.
Please look at the repo that I made, I tried to make it as detailed as possible, I also attached the diff when the app was first initialize vs when the I added the firebase and reproduce the issue.
I may when I have time. I'd appreciate it if you run the script and see if you can reproduce it, as I requested
@mikehardy I think it's not this library that's logging that error, I found the code at https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseCore/Sources/FIRApp.m#L246
That is correct, the underlying sdk logs that, but why would sDefaultApp not be set? It implies configure was not called.
Yet it is specified to call it here: https://rnfirebase.io/#configure-firebase-with-ios-credentials
And I demonstrate same, following dos, here: https://github.com/mikehardy/rnfbdemo/blob/62e8013a5b707c78d986eb3e9cee23f62dc994a0/make-demo.sh#L29
I'd appreciate it if you run the script and see if you can reproduce it, as I requested
I'd appreciate it if you run the script and see if you can reproduce it, as I requested
I will also give that a try
That is correct, the underlying sdk logs that, but why would sDefaultApp not be set? It implies configure was not called.
I think that would be the case, it will really happen if the user just installed the app and then launched it, the first launch firebase hasn't been configured yet, the succeeding launches firebase has already been configured so succeeding launches doesn't log the message.
Looking at the code, I think that's the intention, I think the intention is to check if firebase was configured
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
In which case the problem is that we are using the incorrect method [FIRApp defaultApp]
, whose purpose is to get
the defaultApp
, that's why it logs an error message when the defaultApp
was not set prior to the call.
One solution I can think of is to make a PR to firebase-ios-sdk, create a method that returns a boolean if firebase has been configured:
+ (FIRApp *)hasDefaultApp {
if (sDefaultApp) {
return YES;
}
return NO;
}
Then on rn-firebase, we can change the code from:
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
to:
if (![FIRApp hasDefaultApp]) {
[FIRApp configure];
}
Another solution is to just remove the if statement and just call [FIRApp configure];
every time, from what I've read, it looks safe to do that as [FIRApp configure]
is already checking if the defaultApp
has been set or not
https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseCore/Sources/FIRApp.m#L127
but that will log a different message, which is Default app has already been configured.
and a different issue about that might appear here 馃ぃ so I guess the best solution is to send a PR.
I believe this is not how it works.
That code has to execute and initialize firebase every single time the app starts. Not just first start after install.
So it will ALWAYS appear on the first launch of the app
What experimental results to you have that are consistent with this hypothesis? Have you definitely seen that every time the app is uninstalled completely and reinstalled, you see the referenced error message, but on all subsequent launches not broken by an uninstall, you do not see the warning?
Using an if or not before configure would not alter the production of this log message.
I will not reply further until:
I'd appreciate it if you run the script and see if you can reproduce it, as I requested
I believe this is not how it works.
That code has to execute and initialize firebase every single time the app starts. Not just first start after install.
Then why put it inside an if statement?
I will not reply further until:
I'd appreciate it if you run the script and see if you can reproduce it, as I requested
I'm not actually looking for help about this, I'm looking to help understand this, thanks anyways.
Most helpful comment
Hey, have you added the init to the ios side?
https://github.com/invertase/react-native-firebase-tests/blob/master/ios/ReactNativeFirebaseDemo/AppDelegate.m#L14
https://github.com/invertase/react-native-firebase-tests/blob/master/ios/ReactNativeFirebaseDemo/AppDelegate.m#L20