skip to Main Content

I’m trying to test flutter app using Azure DevOps and Appium. My CI/CD pipeline contains 2 major jobs – build app & run tests. First job creates .app file and passes it as an artifact to the second job. To achieve this I have to launch iOS simulator and build with flutter run. Those actions take significant amount of time and I’m wondering is there a way to build iOS app without a need to create simulator.

I’ve tried flutter build ios --debug --no-codesign but the resulting app is incompatible with the iOS simulator.

2

Answers


  1. Chosen as BEST ANSWER

    In case if someone finds this question by googling. The solution was replacing the --debug flag with --simulator flag:

    build ios --simulator --no-codesign


  2. I’m not sure why you would try to run a built ios app on a simulator as it’s not possible. You can only run ios apps on the ios-simulator as Debug (Runner).

    If you want to test flight on physical a device or upload the ios file, you may need the IPA (.ipa) file.

    Here’s how to do it:

    First build the basic ios app (outputs .app folder)

    flutter build ios --release --no-codesign
    

    Select the release profile for ios runners

    xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release
    

    Now this is a tricky part.

    export IOS_DEV_TEAM=<your ios dev team>
    export IOS_PROVISIONING_PROFILE_UUID=<your ios provisioning profile id>
    xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release DEVELOPMENT_TEAM=$IOS_DEV_TEAM -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive PROVISIONING_PROFILE=$IOS_PROVISIONING_PROFILE_UUID clean archive CODE_SIGN_IDENTITY="Apple Distribution: <Your company name>"
    

    You’ve to create a iOS dev team using AppStoreConnect and then from XCode you’ve to create a provisioning profile. If you already done that before,

    Finally, export the ipa archive:

    xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/ExportOptions.plist
    

    You can find the built .ipa file in build-output/ios/<your app name>.ipa

    Now, you can upload this ipa file for test flight using Transporter. And install in physical iOS device

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search