EddyVerbruggen / nativescript-plugin-firebase

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

iOS environment causes rebuild #1647

Open MeijerJ-Qlip opened 4 years ago

MeijerJ-Qlip commented 4 years ago

I am using the following versions:

I am using seperated environments as described here. I have both GoogleService-Info.plist.dev and GoogleService-Info.plist.prod files in the App_Resources folder.

I run tns debug ios --env.dev --no-hmr Chokidar seems to notice the dev file being copied and renamed and then being deleted again. This triggers a rebuild. This is then missing the GoogleService-Info.plist file which has been deleted earlier. It would be very strange if this was actually the case, because I definitely wouldn't be the only one having issues like this.

Relevant part of log:

nativescript-plugin-firebase: /Users/qlip/Documents/Z-Mob/platforms/ios/.pluginfirebaseinfo not found, forcing prepare!
nativescript-plugin-firebase: running release build or change in environment detected, forcing prepare!
nativescript-plugin-firebase: copy /Users/qlip/Documents/Z-Mob/App_Resources/iOS/GoogleService-Info.plist.dev to /Users/qlip/Documents/Z-Mob/App_Resources/iOS/GoogleService-Info.plist.
Installing pods...
Analyzing dependencies
Pre-downloading: `MaterialShowcase` from `https://github.com/shiv19/material-showc..., branch `nativescript`
Downloading dependencies Installing BEMCheckBox (1.4.1)
Installing Firebase (6.16.0)
Installing FirebaseAnalytics (6.2.2)
Installing FirebaseAnalyticsInterop (1.5.0)
Installing FirebaseCore (6.6.1)
Installing FirebaseCoreDiagnostics (1.2.4)
Installing FirebaseCoreDiagnosticsInterop (1.2.0)
Installing FirebaseInstallations (1.3.0)
Installing FirebaseInstanceID (4.3.4)
Installing FirebaseMessaging (4.2.1)
Installing GoogleAppMeasurement (6.2.2)
Installing GoogleDataTransport (6.2.1)
Installing GoogleDataTransportCCTSupport (3.0.0)
Installing GoogleUtilities (6.7.1)
Installing IQKeyboardManager (6.2.1)
Installing MDFInternationalization (2.0.0)
Installing MDFTextAccessibility (2.0.0)
Installing MaterialComponents (92.5.0)
Installing MaterialShowcase (0.6.5)
Installing MotionAnimator (2.8.1)
Installing MotionInterchange (1.6.0)
Installing PromisesObjC (1.2.9)
Installing Protobuf (3.12.0)
Installing nanopb (0.3.9011)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `ZMob.xcworkspace` for this project from now on.
Pod installation complete! There are 16 dependencies from the Podfile and 24 total pods installed.
Project successfully prepared (ios)
Configure firebase
Building project...
Xcode build...
Chokidar raised event unlink for /Users/qlip/Documents/Z-Mob/App_Resources/iOS/GoogleService-Info.plist.
AnthonyLenglet commented 4 years ago

We've had this issue for a while on our end, mainly happens when testing directly on a phone or by launching the first time on two simulators at the same time

dtomaszewski commented 3 years ago

@MeijerJ-Qlip I have the same case.

Basically I have no idea how should I properly run two environments. Should I download .plist file copy it and rename to .dev and .prod ? Or should I have three .plist files (+one withoult postfix) ? If I have two I see error that .plist file was not found otherwise I have similar case as You, it seems that it works but in fact it just uses this deleted .plist file.

MeijerJ-Qlip commented 3 years ago

@dtomaszewski I have decided not to use the built-in environments for my iOS builds. I already had a seperate shell script to build production and test releases. I included the copying of the right .plist into App_Resources The setup is as follows:

Add GoogleService-Info.plist.dev and GoogleService-Info.plist.prod to the main app folder. Add the dev file to App_Resources with the name GoogleService-Info.plist. This is the part of my script that adds the dev plist:

printf "${COLOR}Switching to dev GoogleService.plist...${NOCOLOR}\n"
cp GoogleService-Info.plist.test App_Resources/iOS
rm App_Resources/iOS/GoogleService-Info.plist
mv App_Resources/iOS/GoogleService-Info.plist.dev App_Resources/iOS/GoogleService-Info.plist

This is the other script that adds the prod plist:

printf "${COLOR}Switching to prod GoogleService.plist...${NOCOLOR}\n"
cp GoogleService-Info.plist.prod App_Resources/iOS
rm App_Resources/iOS/GoogleService-Info.plist
mv App_Resources/iOS/GoogleService-Info.plist.prod App_Resources/iOS/GoogleService-Info.plist

I do use the plugin's system for android builds. Please keep in mind that you will have to reset the plist to the dev version after running a prod build, but I simply do this by discarding all my git changes.