Miro Abaz
Miro Abaz

Reputation: 21

How to build iOS app for simulator using fastlane?

For automation testing purposes I'm trying to build iOS app via jenkins job for simulator using fastlane build_app script.

Two things I'm currently having problems with are:

  1. I don't know how to get .app file straight from build command
  2. When I create .ipa file I get .app file simply by extracting the .ipa, but somehow that .app won't open on my simulator (simulator is the corresponding one)

The lane I'm using looks as following ->

lane :app_for_simulator do
    match(type: "development")
    build_app(
      scheme: "MyApp",
      export_method: "development",
      configuration: "Debug",
      destination: "platform=iOS Simulator,name=iPhone 11,OS=13.1",
      output_name: "MyApp.ipa"
    )
  end

Has anyone had similar problems and managed to resolve them?

Looked across other topics but didn't manage to find the answer. Thanks in advance

Upvotes: 2

Views: 3212

Answers (1)

Lyndsey Ferguson
Lyndsey Ferguson

Reputation: 5374

This is what we use:

xcodebuild(
  {
    clean: true,
    build: true,
    workspace: "./MyApp.xcworkspace",
    output_name: "MyApp.ipa",
    scheme: "MyApp",
    sdk: "iphonesimulator",
    destination: "platform=iOS Simulator,name=iPhone 5s",
    xcargs: "ONLY_ACTIVE_ARCH=NO"
  }
)

# after the build we copy the MyApp.app from the build products
xcodebuild_dir = File.absolute_path("../MyApp/build/Build/Products/SimulatorBuild-iphonesimulator")
Actions.sh("ditto \"#{xcodebuild_dir}/MyApp.app\" \"MyApp.app\"")

Upvotes: 2

Related Questions