iakta / flutter_flavors

A flutter app to show flavors in flutter
80 stars 12 forks source link

How to use? #2

Open js1972 opened 6 years ago

js1972 commented 6 years ago

Hi there, just found your excellent blog post on flutter flavors. Its something I've been seriously struggling with the past couple of weeks - just how do we use flutter to get production archives that have different bundle id's. Everything I've tried seems to break the flutter build tools.

btw. I could not work out how to post comments on your website - hence this is an issue - feel free to delete if theres a better way to communicate.

I'm just wondering - after setting up the config and schemes in Xcode as per your post - what is now the typical developer workflow?

i.e. I still use IntelliJ or VSCode to develop and run on my own phone and sims. But when I want to build the app and send it to QA testers for example - what would you do? Run flutter build ios --flavor qa. Do I then distribute the binary that is created or do I still need to go into Xcode and switch to the qa scheme and then run Product->Archive to get the app to send to testers?

I'm new to iOS as you can probably tell. ;-)

zontarian commented 6 years ago

Hi,

TLDR: we use XCode to distribute and do real tests on iOS devices (looking at logs, breakpoints in native plugins etc..).

Longish story is: usually our pipeline is like this

When ready for production or staging (i.e. releasing via TEstFlight to developers) we do

Hope it helps..

js1972 commented 6 years ago

Appreciate your help. ;-) When I run the flutter build ios —release —flavor staging I get the build errors mentioned above so can’t get past that step. There must be other config required somewhere....

js1972 commented 6 years ago

Just realised I didn’t specify the errors. Away from my computer now but the first was that Xcode could not find the generated xcconfig files that we reference in the new config files. The others were a bunch of crazy cocoa pods errors. I’ll come Back to this tomorrow. ;-)

stefandevo commented 5 years ago

The iOS part does not work. In the IDE I created the two flavor configurations, then run development on the ios simulator: Output:

Launching lib/main-dev.dart on iPhone Xʀ in debug mode...
Removing obsolete reference to flutter_assets from Runner.app
Running Xcode build...
Xcode build done.                                           17.8s
ProcessException: Process "/usr/bin/xcrun" exited abnormally:
it.iakta.flutterFlavors$(bundle_suffix): -1

An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1):
The request to open "it.iakta.flutterFlavors$(bundle_suffix)" failed.
The request was denied by service delegate (SBMainWorkspace) for reason: NotFound ("Application "it.iakta.flutterFlavors$(bundle_suffix)" is unknown to FrontBoard").
Underlying error (domain=FBSOpenApplicationErrorDomain, code=4):
    The operation couldn’t be completed. Application "it.iakta.flutterFlavors$(bundle_suffix)" is unknown to FrontBoard.
    Application "it.iakta.flutterFlavors$(bundle_suffix)" is unknown to FrontBoard.
  Command: /usr/bin/xcrun simctl launch 6A5CD5B3-0A2F-42CF-B593-10E63D82575E it.iakta.flutterFlavors$(bundle_suffix) --enable-dart-profiling --enable-checked-mode --verify-entry-points --observatory-port=0
Error launching application on iPhone Xʀ.

Then run production:

Launching lib/main.dart on iPhone Xʀ in debug mode...
Running Xcode build...
Xcode build done.                                            9.3s
ProcessException: Process "/usr/bin/xcrun" exited abnormally:
it.iakta.flutterFlavors$(bundle_suffix): -1

An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1):
The request to open "it.iakta.flutterFlavors$(bundle_suffix)" failed.
The request was denied by service delegate (SBMainWorkspace) for reason: NotFound ("Application "it.iakta.flutterFlavors$(bundle_suffix)" is unknown to FrontBoard").
Underlying error (domain=FBSOpenApplicationErrorDomain, code=4):
    The operation couldn’t be completed. Application "it.iakta.flutterFlavors$(bundle_suffix)" is unknown to FrontBoard.
    Application "it.iakta.flutterFlavors$(bundle_suffix)" is unknown to FrontBoard.
  Command: /usr/bin/xcrun simctl launch 6A5CD5B3-0A2F-42CF-B593-10E63D82575E it.iakta.flutterFlavors$(bundle_suffix) --enable-dart-profiling --enable-checked-mode --verify-entry-points --observatory-port=0
Error launching application on iPhone Xʀ.

Note on the simulator I have now 2 icons for each build flavor and they work when starting it manually, but integrated this does not work - prop due to flutter issues not "finding" the correct app to open.

stefandevo commented 5 years ago

I create an issue https://github.com/flutter/flutter/issues/31891 and there might me already a PR https://github.com/flutter/flutter/pull/31039 for it...