arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1.01k stars 1.56k forks source link

iOS build issues with invalid window.FirebasePlugin #1101

Open webdevonline opened 5 years ago

webdevonline commented 5 years ago

Hello, We have been building cordova apps using the Firebase Plugin for two years. In the last few months we, as have many others, experienced build issues that caused us to migrate to the Firebasex plugin. That solved our problem for android, but our iOS builds are failing. The problem appears to be due to the window.FirebasePlugin variable being null or invalid.

We have tried to make sure we have put our Firebase calls after a successful ondeviceready response, but it is still failing.

Any help would be greatly appreciated.

bipoza commented 5 years ago

In my case I have to specify that window is any. I don't know if it will be useful, but in my case with ionic 3 it worked perfectly for me.

Examples

(<any>window).FirebasePlugin.logError(String(error)); (<any>window).FirebasePlugin.setAnalyticsCollectionEnabled(true); (<any>window).FirebasePlugin.setPerformanceCollectionEnabled(true); (<any>window).FirebasePlugin.setCrashlyticsCollectionEnabled();

Source - https://stackoverflow.com/questions/40494369/anywindow-somelibrary-somemethodarg1-arg2

I think the current repository is deprecated. I have to thank the Firebasex fork that has made many projects go ahead.

webdevonline commented 5 years ago

Thanks for the response. We managed to get past the error above, and worked through some other errors as well. Our iOS builds are working again. One thing we had to do was install Cocoapods. So if anyone else is having similar problems, I would recommend they check to see if they have Cocoapods in their project.

Brianfit commented 4 years ago

I have installed cocoapods to my cordova projects in the past and every time I've vowed "Never Again." When Firebasex saved my Android app, I decided to install it again in the hope it would simply work and get my IOS version going. Nightmare. Tore everything down and went back. I would run my IOS app without Firebase if I had to, such is my dismay at ever typing pod install again.

Fortunately, I don't have to. By using Plugman to install this version of Firebase on my IOS platform only, I had a fairly painless install (had to manually copy GoogleService-Info.plist to its destinations in the Build and Resources folders) and it runs and reports perfectly.