IOS instruments crashes with bare bones application

Edit: I discovered that I need to specify the SDK for the simulator. By default xcodebuild builds for the real device.

My learning journey got stopped in its tracks by something I cannot explain with my limited knowledge of IOS development.

I created a fresh IOS application in Xcode with nothing in it but just the template. Then I run the test script (see below). I can see the IOS simulator show up. The app shows up briefly, then disappears and the whole process repeats. See the appium log for details.

Any thoughts on why instruments crashes?

Ruby test script:

require 'rubygems'
require 'appium_lib'

APP_PATH = 'ALE-News/Build/Debug-iphoneos/ALE-News.app'

desired_caps = {
  caps:       {
    deviceName:    'iPhone 6',
    platformVersion: '8.1',
    platformName: 'ios',
#    browserName: 'safari',
    app: APP_PATH
  },
  appium_lib: {
    sauce_username:   nil, # don't run on Sauce
    sauce_access_key: nil
  }
}

# Start the driver
Appium::Driver.new(desired_caps).start_driver

module ALENews
  module IOS
    Appium.promote_singleton_appium_methods ALENews

    sleep 2
    
    screenshot "./test.png"
    
    # Quit when you're done!
    driver_quit
    puts 'Tests Succeeded!'
  end
end

Appium log:

info: Welcome to Appium v1.3.1 (REV 1160ce02bb89c354cb99317985123acf39f0e7d3)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"deviceName":"iPhone 6","platformVersion":"8.1","platformName":"ios","app":"/Users/sns/Documents/dev/ale-news-atdd/source/ios/ALE-News/Build/Debug-iphoneos/ALE-News.app"}}
info: Client User-Agent string: Ruby
info: [debug] Using local app from desired caps: /Users/sns/Documents/dev/ale-news-atdd/source/ios/ALE-News/Build/Debug-iphoneos/ALE-News.app
info: [debug] Creating new appium session de01f42f-0794-4f99-a161-cf70897dbcd0
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version
info: [debug] Setting iOS SDK Version
info: [debug] Getting sdk version from xcrun with a timeout
info: [debug] iOS SDK Version set to 8.1
info: [debug] Checking whether instruments supports our device string
info: [debug] Getting list of devices instruments supports
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.1","iOSSDKVersion":"8.1","deviceName":"iPhone 6","platformVersion":"8.1"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6 (8.1 Simulator)'
info: [debug] iOS sim UDID is 580E873B-7F00-4753-875B-F7F31A0BBDA0
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Could not parse plist file (as binary) at /Users/sns/Documents/dev/ale-news-atdd/source/ios/ALE-News/Build/Debug-iphoneos/ALE-News.app/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
`parseFileSync()` is deprecated. Use `parseStringSync()` instead.
info: [debug] Could not parse plist file (as XML) at /Users/sns/Documents/dev/ale-news-atdd/source/ios/ALE-News/Build/Debug-iphoneos/ALE-News.app/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings; assuming it doesn't exist
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating instruments
info: On some xcode 6 platforms, instruments-without-delay does not work. If you experience this, you will need to re-run appium with the --native-instruments-lib flag
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/sns/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {"nodePath":"/usr/local/Cellar/node/0.10.32/bin/node","commandProxyClientPath":"/usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false}
...o: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
info: [debug] Dynamic bootstrap path: /Users/sns/Library/Application Support/appium/bootstrap/bootstrap-0ca2c821373eb439.js
info: [debug] Reusing dynamic bootstrap: /Users/sns/Library/Application Support/appium/bootstrap/bootstrap-0ca2c821373eb439.js
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.1","iOSSDKVersion":"8.1","deviceName":"iPhone 6","platformVersion":"8.1"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6 (8.1 Simulator)'
info: [debug] We're on iOS7.1+ so forcing defaultDevice on
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.1","iOSSDKVersion":"8.1","deviceName":"iPhone 6","platformVersion":"8.1"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6 (8.1 Simulator)'
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Wrote new app Info.plist with device type
info: [debug] Checking whether we need to set app preferences
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iOS Simulator
info: [debug] Killing any other simulator daemons
info: [debug] Cleaning sim data files
info: [debug] Executing: xcrun simctl erase 580E873B-7F00-4753-875B-F7F31A0BBDA0
info: [debug] Cleaning app data files
warn: Applications directory /Users/sns/Library/Developer/CoreSimulator/Devices/580E873B-7F00-4753-875B-F7F31A0BBDA0/data/Containers/Data/Application doesn't exist. Have you run this simulator before?
warn: Applications directory /Users/sns/Library/Developer/CoreSimulator/Devices/580E873B-7F00-4753-875B-F7F31A0BBDA0/data/Containers/Bundle/Application doesn't exist. Have you run this simulator before?
info: Couldn't find app directories to delete. Probably it's not installed
info: [debug] Not setting locale
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 8.* simulator log capture
info: [debug] Not pre-launching simulator
info: [debug] No device id or app, not installing to real device.
info: [debug] Starting command proxy.
info: [debug] Instruments socket server started at /tmp/instruments_sock
info: [debug] Starting instruments
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (8.1 Simulator)
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (8.1 Simulator)" /Users/sns/Documents/dev/ale-news-atdd/source/ios/ALE-News/Build/Debug-iphoneos/ALE-News.app -e UIASCRIPT "/Users/sns/Library/Application Support/appium/bootstrap/bootstrap-0ca2c821373eb439.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6/InstrumentsShim.dylib","LIB_PATH":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST] Waiting for device to boot...
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: Failed looking up pid of launched process
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #1
info: [debug] Killall iOS Simulator
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (8.1 Simulator)
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (8.1 Simulator)" /Users/sns/Documents/dev/ale-news-atdd/source/ios/ALE-News/Build/Debug-iphoneos/ALE-News.app -e UIASCRIPT "/Users/sns/Library/Application Support/appium/bootstrap/bootstrap-0ca2c821373eb439.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6/InstrumentsShim.dylib","LIB_PATH":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST] Waiting for device to boot...

I’m sorry you’re experiencing difficulties. We’re currently debugging this issue: https://github.com/appium/appium/issues/3924.