47

I am android developer learning Flutter, and I really have some trouble trying to create debug .ipa file, for testing purposes.

So, I managed to create Runner.app file using command from Terminal:

flutter build ios --debug

The location of Runner.app file is

my_project_folder/build/ios/iphoneos/Runner.app

What to do next? Also, is there a way to create debug .ipa file from Xcode? Thanks.

GianhTran
  • 3,443
  • 2
  • 22
  • 42
miloss
  • 1,708
  • 1
  • 21
  • 18

5 Answers5

90

You can create .ipa file by your self and send iOS build url to your client or other.

Just follow me :)

1) Generate your iOS build by below command
-> flutter build ios --release/debug

2) You will found exact path of your Runner.app Ex.
-> Built /Users/UserName/Documents/AppName/build/ios/iphoneos/Runner.app. Just find this Runner.app file and do copy/paste it to Desktop.

3) Create folder name is "Payload" (case-sensitive) on Desktop

4) Move your Runner.app File in the "Payload" folder.

5) Compress Payload folder to default .zip

6) Convert/rename Payload.zip to Payload.ipa

That's it. Now you have to open "Diawi" and Upload the Payload.ipa on it. Wait for 100% done. Click on send button. You will find one url, Send this url to your client or any other person. They can install on his/her device.

~ PS : Make sure diawi Url valid for those UDIDs that attached with your provisioning profile. And I haven't tried these steps to upload app on TestFlight/AppStore.

iPatel
  • 46,010
  • 16
  • 115
  • 137
27

flutter build ipa is now available and takes an optional --export-options-plist flag to make an IPA from the archive bundle. See flutter build ipa -h on the master channel for details.

Bill
  • 286
  • 3
  • 3
  • 1
    Seems a good option but it is only supported in macOS :/ :S – Lady Geraldine Villamil Guerre Jun 11 '21 at 16:35
  • 1
    Tip: Easiest way to have ExportOptions.plist is to manually export the IPA from the Runner.xcarchive for the first time, which would generate four files one of them is the export options. Just copy it and keep it in the project to be used with the command in this answer – a7md0 Nov 08 '21 at 09:40
  • 6
    After you run flutter build ipa, where is now the directory of the ipa file? – Duck Dodgers May 18 '22 at 10:31
  • @a7md0 Can you elaborate? – Krish Bhanushali Jun 09 '22 at 14:51
  • @KrishBhanushali If you used their Archiver utility to export the IPA for the 1st time it would output the IPA with other files. One of these files is the plist with the export options. Sorry I cannot get you the exact steps since I do not have access to Mac machine at the moment – a7md0 Jun 09 '22 at 16:11
3

I have a simple implementation combining a Makefile and Fastlane. This way, I can run make beta from my project directory to deploy.

./Makefile:

.PHONY: beta
beta:
    flutter build ipa --export-options-plist=ExportOptions.plist
    cd ios && fastlane beta ipa:../build/ios/ipa/YourBundleName.ipa

./ios/fastlane/Fastfile:

platform :ios do
    lane :beta do |options|
        # ... pre-delivery actions, eg: `match(type: "appstore")`
        pilot(
            ipa: options[:ipa]
            # ... the rest of your pilot configuration
        )
        # ... post-delivery actions, eg: `slack(message: "Uploaded to TestFlight")`            
    end
end

Note that I use match(type: "appstore"), so that's why you see signingStyle as manual.

./ExportOptions.plist:

<?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>compileBitcode</key>
    <true/>
    <key>method</key>
    <string>app-store</string>
    <key>provisioningProfiles</key>
    <dict>
        <key>your.bundle.identifier</key>
        <string>Your Provisioning Profile Name</string>
    </dict>
    <key>signingCertificate</key>
    <string>iOS Distribution</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>YourTeamId</string>
    <key>thinning</key>
    <string>&lt;none&gt;</string>
</dict>
</plist>
Jared Anderton
  • 826
  • 9
  • 12
2

I use the next bash-script

flutter build ios --debug
cd ios
xcodebuild -workspace Runner.xcworkspace -scheme Runner archive -archivePath Runner.xcarchive
xcodebuild -exportArchive -archivePath Runner.xcarchive -exportOptionsPlist ../scripts/exportOptions.plist -exportPath ../scripts -allowProvisioningUpdates
rm -fr Runner.xcarchive

ipa will be created at '../scripts'. You may have own path.

-allowProvisioningUpdates is using if you want xcodebuild updates certificates automaticaly.

exportOptions.plist - it's a file with distribution settings. I use next

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>compileBitcode</key>
    <false/>
    <key>method</key>
    <string>enterprise</string>
    <key>signingStyle</key>
    <string>automatic</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>YOUR TEAM ID</string>
</dict>
</plist>
JagrDev
  • 107
  • 4
  • 3
    Note that this actually will build your project twice: once with flutter build ios, and once with xcodebuild -workspace. Both are using different build folders, so each source file needs to be built twice, wasting lots of time and CPU cycles. Hasn't anyone found a better solution? – Avi Jan 10 '20 at 15:23
  • Is `flutter build ios` needed? – Yahya Uddin Jun 07 '20 at 06:17
  • My team doesn't does not support enterprise app distribution, so I have changed "method" to "development" just for my purposes :) – lisek Apr 06 '22 at 08:36
-1

These are the next steps outlined in the instructions (which are found here: https://flutter.io/ios-release/):

In Xcode, configure the app version and build:

In Xcode, open Runner.xcworkspace in your app’s ios folder.
Select Product > Scheme > Runner.
Select Product > Destination > Generic iOS Device.
Select Runner in the Xcode project navigator, then select the Runner target in the settings view sidebar.
In the Identity section, update the Version to the user-facing version number you wish to publish.
In the Identity section, update the Build identifier to a unique build number used to track this build on iTunes Connect. Each upload requires a unique build number.

Finally, create a build archive and upload it to iTunes Connect:

Select Product > Archive to produce a build archive.
In the sidebar of the Xcode Organizer window, select your iOS app, then select the build archive you just produced.
Click the Validate… button. If any issues are reported, address them and produce another build. You can reuse the same build ID until you upload an archive.
After the archive has been successfully validated, click Upload to App Store…. You can follow the status of your build in the Activities tab of your app’s details page on iTunes Connect.
dazza5000
  • 7,075
  • 9
  • 44
  • 89