What exactly does Flutter build iOS do? Is this really necessary?

531

The reason you should run a flutter build ios before archive is because archive uses the last build configuration from the results of running flutter build ios.

Share:
531
Tomas Baran
Author by

Tomas Baran

Updated on November 21, 2022

Comments

  • Tomas Baran
    Tomas Baran over 1 year

    I would like to fully understand this command and what happens behind the scenes. Here are a few pieces of information I've understood so far but somehow I cannot connect the dots:

    • When deploying an iOS we need to go through these steps:
    1. build a flutter app in release mode, which will make an .app file/folder
    2. archive & sign the .app file which will convert it into .ipa
    3. send the signed .ipa to the appstore
    • flutter apps can have 3 modes: 1. debug 2. release 3. profile
    • running flutter build ios creates a build/ios folder, including the Release-iphoneos/Runner.app
    • Xcode creates its own .app in ~/Library/Developer/Xcode/DerivedData/Runner-...

    Now, questions:

    1. Is the build/ios/Release-iphoneos/Runner.app that Xcode converts into .ipa? I'm asking since I know that Xcode creates its own .app in ~/Library/Developer/Xcode/DerivedData, so I'm not sure if Xcode just copies build/ios/Release-iphoneos/Runner.app in here: ~/Library/Developer/Xcode/DerivedData/ or not
    2. What happens if I don't run flutter build ios before? Will Xcode use only a debug mode of my app? If so, how come it removes the debug flag in the upper right corner? enter image description here
    3. When I clean my build folder in Xcode (shift+cmd+K) and then I archive the app and it will still build a new .app and then it converts it to .ipa. What mode was this .app created in? Was it a release app? If so, again, why is it necessary to run flutter build ios before and why not just archive it from the Xcode?

    Thanks to everyone who tries to unleash this big mystery for me and for everyone else wondering.