EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 444 forks source link

iOS app crashes straight after splash screen (iOS 11.2, iPhones X, 8 & 7 on simulator) #618

Closed sethprogress closed 6 years ago

sethprogress commented 6 years ago

Create a new {N} + ng + TS, add plugin and initialize firebase as per documentation (and per ng sample) results in iOS app crashing with no errors straight after splash screen. Same as reported here: https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/611

EddyVerbruggen commented 6 years ago

Can you share a repo?

sethprogress commented 6 years ago

Thanks for the quick reply https://bitbucket.org/nexuschurch/mynexus-app/src

EddyVerbruggen commented 6 years ago

Thank you!

There's an issue in 5.1.5 that pops up when the 'realtime db' feature wasn't selected. I'll correct that in 5.1.6 but I'm not entirely sure it will fix your issue as I cloned your repo, did tns run ios, and it loaded the app just fine (bar the error about init in the log that's fixed in 5.1.6) -- it didn't crash.

So before releasing the fix, can you please open node_modules/nativescript-plugin-firebase/firebase.ios.js and replace theresolve` statement on line 600 by this one?

resolve(typeof (FIRDatabase) !== "undefined" ? FIRDatabase.database().reference() : undefined);

Then tns run ios and see if that makes a difference.

manijak commented 6 years ago

I had the same issue when I installed the plugin today (first time ever). Decided to clean my platform after installation and configuration of the plugin, re-installed iOS platform, and it just worked.

But I do keep seeing this in the console: CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:603:24: Error in firebase.init: ReferenceError: Can't find variable: FIRDatabase

Replace the line 600 from previous post, exception still present.

EddyVerbruggen commented 6 years ago

@manijak If you replace the line as show below, rm -rf platforms/ios, and tns run ios then there shouldn't be an error.

screen shot 2018-01-31 at 18 43 37
manijak commented 6 years ago

Correct, the error is now gone. thanks.

sethprogress commented 6 years ago

@manijak - i'm a bit new to NS, what do you mean by this: Decided to clean my platform after installation and configuration of the plugin, re-installed iOS platform?

Is that just deleting the platform folder or is it some commands.

manijak commented 6 years ago

Yeah running following commands: tns platform remove ios tns platform add ios tns build ios

sethprogress commented 6 years ago

First I modified the resolve statement, enabled realtime and did rm -rf platforms/ios - Successful!

Thanks for your help guys. I didn't need to remove the platform.