Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using --dart-define with Xcode archive and distribute

Tags:

xcode

ios

flutter

When building an appbundle for android I am able to use --dart-define with the flutter build appbundle shell command to define env variables for this bundle. How can I do that with Xcode workflow of Archive and Distribute?

like image 821
shadysamir Avatar asked Sep 20 '25 02:09

shadysamir


1 Answers

You can generate the .ipa with this command flutter build ipa --dart-define="var_name=value" --export-options-plist=ios/fastlane/ExportOptions.plist

And the ExportOptions.plist is something like that

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>destination</key>
        <string>export</string>
        <key>method</key>
        <string>app-store</string>
        <key>provisioningProfiles</key>
        <dict>
                <key>your.app.id</key>
                <string>Provisioning Profile Name</string>
        </dict>
        <key>signingCertificate</key>
        <string>Apple Distribution</string>
        <key>signingStyle</key>
        <string>manual</string>
        <key>stripSwiftSymbols</key>
        <true/>
        <key>teamID</key>
        <string>YOU_TEAM_ID</string>
        <key>uploadSymbols</key>
        <true/>
</dict>
</plist>
like image 161
Xande Rasta Moura Avatar answered Sep 21 '25 20:09

Xande Rasta Moura