Skip to content

Instantly share code, notes, and snippets.

@jmoody
Created December 12, 2014 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmoody/7543629290b7e192a261 to your computer and use it in GitHub Desktop.
Save jmoody/7543629290b7e192a261 to your computer and use it in GitHub Desktop.
Hot Topic: When targeting a Simulator, the app launches, then quits several times in rapid succession.

1. When targeting a Simulator, the app launches, then quits several times in rapid succession.

The problem is that the binary in incompatible with the simulator version.

For example, if you build an app iPhone 6 Simulator it will contain an x86_64 instruction slice. You can install this binary on an iPhone 4s simulator, but it will not launch because the iPhone 4s Simulator because that simulator requires an i386 instruction set. Simply put, you must build an app that is compatible for the simulator you are targeting.

Here are some steps you can take to solve this problem.

Make sure you have the latest version of calabash and the latest version of the framework. [1] If you are not using bundler already, now would be a good time to start. [2]

UPDATE Calabash 0.12.0.pre1 will raise an error if the .app is incompatible for the target simulator.

Clear the Simulator Content & Settings.
# Resets _all_ the simulators
$ bundle exec calabash-ios sim reset
Building Compatible Binaries: xcodebuild

Here is an example of a xcodebuild command that will build an .app that is compatible for all simulators.[3][4]

xcrun xcodebuild \
    -SYMROOT=build \
    -derivedDataPath build \
    ARCHS="i386 x86_64" \
    VALID_ARCHS="i386 x86_64" \
    ONLY_ACTIVE_ARCH=NO \
    -project ./path/to/your/.xcproject directory \
    -scheme "The Name of your Calabash Scheme" \
    -sdk iphonesimulator \
    -configuration DEBUG \
    clean build

The .app can be found in this directory: "./build/Build/Products/Debug-iphonesimulator/YourApp.app" Use this path as your APP path. [5]

$ export APP="./build/Build/Products/Debug-iphonesimulator/YourApp.app"
$ bundle exec cucumber 
Building Compatible Binaries: Xcode

Adjust the build settings of your Calabash target to always build a compatible binary.


2014-12-12_12-52-47


Links

See also these two issues:

  • When targeting a Simulator, the app launches every second in a loop #645
  • Launch screen appears and disappears again and again when targeting a simulator #649
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment