Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring multiple scheme in iOS causes mismatch in flavors

Tags:

I have a Flutter Project, I have created two separate firebase projects(not two apps in same firebase project). I am setting two different schemes for my iOS app. I have following commands to use different projects accordingly

1.flutter run --release --flavor prod 2.flutter run --release --flavor dev

For dev flavour it need to use the dev project created in firebase but it uses the production firebase project and vice versa.

The configuration works properly for Android and not for iOS.

I am following the below tutorials for iOS setup

https://www.tengio.com/blog/multiple-firebase-environments-with-flutter/ https://www.youtube.com/watch?v=gdqnxcV7_FY&feature=emb_logo

As you can see below image for how I have setup my Google services file. I have checked many times and I am not mismatching those files by putting prod in dev and vice versa.

Following is my script

enter image description here

enter image description here

I have also added the Google services file to targets. I tried removing the checkmark of targets as well for Google services file but still same issue.

One thing I noticed is that if I add the prod google services file after the dev google services file to my iOS project it always use the prod environment irrespective of flavor. If I add dev after prod then it uses dev environment of firebase irrespective of flavor. Even changing the command line build options in xcode does not work for me.

like image 327
Neat Avatar asked Jan 28 '20 07:01

Neat


1 Answers

GoogleService-Info.plist must be on project's root directory. Move all GoogleService-Info.plist to project's root, change their name. for example add scheme to the name like GoogleService-Info-prod.plist

and change your command to

cp -r "$PATH_TO_GOOGLE_PLISTS/GoogleService-Info-prod.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist"

do this for all schemes

like image 152
Hamed Avatar answered Sep 30 '22 21:09

Hamed