last day (19 days later) » 

3:15 PM
Hi!
Are you there?
 
so, let we see your setup
so I can understand better
you have on Firebase project or two different project?
in your firebase console
 
2 different project
 
okay
and in one (the production) you have add an ios app
with bundle id
com.example.myapp
 
3:24 PM
and in the second (staging) you have set com.example.staging.myapp?
or com.example.development.myapp?
 
com.example.myapp.development
 
okay
so you should have 2 Google-Info.plist files
one for production and one for staging
donwloaded from Firebase console
right?
 
good
let start easy
if you simply add your bundle id with xcode
the staging one
and use the Google-Info.plist file of staging
did you get any error?
 
no error
 
3:32 PM
Good
:)
So now try set with XCode your bundle id of production and add your build script
pay attention to typos
and leve your Google-Info.plist of staging
any errors?
 
I am use script for copy Google-Info.plist to Runner
 
Well we are doing that by steps
take Google-info.plist of staging and with your build script change only the bundle id
like I told you in my answer
We need to focus on the exact point of failure ;)
so we start easy and add complexity one step at a time
any errors?
 
if add build script like in you answer have error
The project's Bundle ID is inconsistent with either the Bundle ID in 'GoogleService-Info.plist', or the Bundle ID in the options if you are using a customized options.
but if change build phase and add before Compile Sources no error
 
Oh yes, you got it
I was missing it
so now if you leave this settings and add also you script to chagne your GoogleSerivce-Info.plist
you should have your setup (staging/production) up and running
ain't it?
 
3:57 PM
development flavor is work
but no production
 
uhm...
let's sum up
you set with XCode your bundle id as com.example.myapp
and added in Runner/GoogleServices.plist of production
then you have one or two build script in BuildPhases
before the build script of Compile Sources
that 1. Change your bundle id
2. Copy and Replace your GoogleServices-Info.plist of production with the staging one
right?
 
and 1 and 2 run only if configuration is Debug
so in this configuration if you build your app it goes to staging and working well
now if this works, if you compile with release schema you should go in production
if you want to add a schema that run on production too but in debug mode
we need to do a more setup
but just try to compile in release and you shuold go on production
 
I see issue
issue is how bundle id is set
 
4:12 PM
what do you mean?
 
you method change CFBundleIdentifier
so change bundle id when config is development
 
yup
 
but when try run production bundle id is stay same (develop id)
 
no sorry
I didn't get
maybe bacause some build cache
but if you add an else to the if statement and change it all the time does it works?
if you change bundle id according to configuration if debug you set the staging version in release you set the production one.
 
no still not work
 
4:19 PM
O_O
:-]
can you please post here your build scripts?^^
and tell me how you run your debug/release?
from flutter run or from xcode?
 
if [ "${CONFIGURATION}" == "Debug-prod" ] || [ "${CONFIGURATION}" == "Release-prod" ] || [ "${CONFIGURATION}" == "Release" ]; then
cp -r "${PROJECT_DIR}/Runner/Firebase/Prod/GoogleService-Info.plist" "${PROJECT_DIR}/Runner/GoogleService-Info.plist"

echo "Production plist copied"

elif [ "${CONFIGURATION}" == "Debug-dev" ] || [ "${CONFIGURATION}" == "Release-dev" ] || [ "${CONFIGURATION}" == "Debug" ]; then

cp -r "${PROJECT_DIR}/Runner/Firebase/Dev/GoogleService-Info.plist" "${PROJECT_DIR}/Runner/GoogleService-Info.plist"
flutter run --flavor development
 
and you have also one that change the bundle id
ain't it
I cannot see it here
 
if [ "${CONFIGURATION}" == "Debug-dev" ] || [ "${CONFIGURATION}" == "Release-dev" ] || [ "${CONFIGURATION}" == "Debug" ]; then

/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.example.myapp.development” "${PROJECT_DIR}/Runner/Info.plist"

elif [ "${CONFIGURATION}" == "Debug-prod" ] || [ "${CONFIGURATION}" == "Release-prod" ] || [ "${CONFIGURATION}" == "Release" ]; then

/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.example.myapp” "${PROJECT_DIR}/Runner/Info.plist"
fi
 
okay, if you run your project from XCode it should work, could you try it out?
I was thinking the right way to run a Target configuration from xcode, You are using flavors (like that right? medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36) that actually I still didn't use it.
 
same issue with run from xcode
 
4:31 PM
But I know well how xcode works, so if you build with the right target configuration all should workd
 
yes correct
 
do you know hot to change configuration build?
in XCode?
I could guide you through if you don't
and if you want to try that of course ^^
 
you mean run different scheme?
 
nope
the same scheme
debug but with different configuration
If you go in Edit Scheme
 
4:36 PM
and in your Run change build configuration with the one of production
in Info tab you shold see a drop down menu
in a standard project
Debug and release
you have
and podfile
 
I have set now
 
to release?
how many values do you have?
 
7
debug
debug-development
debug-production
 
okay
so now we try debug-production and this is the value you have to set in your build script
these are the values
if [ "${CONFIGURATION}" == "debug-development" ] || [ "${CONFIGURATION}" == "debug-production" ] || [ "${CONFIGURATION}" == "Debug" ]; then
if you now set debug-production in xcode and run the application you should go to production
provided that your if statement in build script is correct
in the left column of XCode (the one with the project structure) you have 9 icons
the last one is the Report navigator where you can see your echo build script commands
 
why you change value?
 
4:44 PM
to check if it works
for example if you see the archive scheme
you see that is release
because to upload the application to app store you need an ipa compiled with release scheme
now we change the bundle id and google-info.plist accorging to this build configurations
and to do it on XCode we need to change
but flutter run --flavor should do it passing a command line variable to xcode build. But before checking why this doesn't happen I would be sure that our configuration works as expected
if you run alway with the same target configuration (debug as default) you enter always the staging settings
 
so I change this value for change bundle id script?
 
this check
"${CONFIGURATION}" == "debug-development"
is the name you see in the previous drowdown list
where you said you have 7 values
to this trigger only for production if in your Run you have the production value
I mean this check is based on the names you see in this list
and yep, changing it change your config file and bundle id accordingly
and all should work
then we can check if also running flutter run --flavor works
and that's all ^^
 
yes configuration is "Debug-development"
 
okay if you change in Debug-production you should go to production
 
I have now change script in build script as you say to
if [ "${CONFIGURATION}" == "debug-development" ] || [ "${CONFIGURATION}" == "debug-production" ] || [ "${CONFIGURATION}" == "Debug" ];
 
4:55 PM
pay attention to uppercase
and lowercase
be aware
shell is case-sensitive
 
ok I have change case
 
then let's try it out
try run scheme with debug-development and with debug-production and check if all works as expected
 
In UI is work as expect for debug-production
 
yeah! great
now save and let's try with flutter run
 
but output still: Bundle ID is inconsistent with either the Bundle ID in 'GoogleService-Info.plist', or the Bundle ID in the options if you are using a customized options.
 
4:59 PM
and do your echo commands show that all worked fine?
put echo in your build script to all if path and see if you enter the right ones during compilation ;)
 
correct one enter for debug-production
 
either for bundle id and for GoogleService-Info.plist
 
both correct
 
...so if both script are before compile sources... I'm out of clues for today
need to try it out by myself... but I cannot today
 
5:16 PM
When run from xcode is work now
no plist error
when specify build configuration in scheme
 
Oh, yeah. Gr8
^^
Glad to here that
 
For example: for development scheme select Debug-development
for production scheme select Debug-production
 
exactly
right
It was that I was expecting
now the last step (:cross_fingers:)
try flutter run
with flavours
If it doesn't work I need to check it out by my own, 'cause as I told you I still didn't try flutter run --flavour yet
but I hope it will work
 
no is not work with flutter run --flavor development
 
I need to check it, but today I cannot. What doc did you follow to add flavour? If you post it here I'll try to replicate
In the meanwhile if you didn't try a solution by yourself you could always use XCode ;-]
 
You are welcome. It's always nice to teach and learn all together! ^^
 
Yes can use xcode for solo development but I need run CI/CD also so need use flutter build. If cannot use flutter build command then cannot automate build
 
Yep, I've read the post
and I got what we are missing
From the article flutter run use schemes
and we have play only with configurations inside the Runner scheme
ain't it?
What we are missing (or I was missing) is that now
you have to clone the Runner scheme
and give it a name accordingly
I don't know if you already have done but let's start over and clone the scheme where you add the build script (I guess the Runner one)
call it Runner-development
and change the run configuration to Debug-development
then clone again the Runner scheme and call it Runner-production
and change its run target with Debug-production
now if I get it right if you run flutter run --flavour production you'll use the Runner-production scheme where you set Run with Debug-production
and if you run flutter run --flavour development you'll use Runner-development scheme where you set Run with Debug-development
I gotta go! cheers for today!
 
5:45 PM
yes I setup schemes. flutter run --flavor development not work. only work if run from xcode
Let me know if you make work!
actual also have some issue with xcode
 

  last day (19 days later) »