[RESOLVED] Unable to install .ipa on iOS device even though manual fruitstrap install works

Environment:
Appium 1.3.5 npm, iPad Retina (8.1.3) or iPhone 6 (8.1.2), Mac OS 10.10.2, Xcode 6.1.1

I have a situation where a colleague can install and launch the same .ipa that fails for me. I have compared our server logs and the difference is that it appears the installation is not even attempted on my machine. Observations:

  • Using the Appium version of fruitstrap will successfully install the app, so it’s not a code-signing issue.

  • Fruitstrap crashes when running the isInstalled check (for my colleague as well.) The only diagnostics is this: Assertion failed: (false), function checkAppExists, file fruitstrap.c, line 320.

  • I have uninstalled and re-installed Appium. I have also re-installed XCode from the App store instead of from the developer portal, just as my colleague did. (The XCode install from the portal was causing all sorts of other issues, fwiw.)

  • The command-line server and Appium.app produce the same results.

  • When I build our app for the simulator, it installs and launches fine.

  • If I install the .ipa manually (fruitstrap or iTunes), I can use Appium to launch the test fine. Only the installation fails.

  • The device is registered, UI Automation is enabled, the certs and profiles are good.

Here’s the log:

~$ appium
info: Welcome to Appium v1.3.5 (REV a124a15677e26b33db16e81c4b3b34d9c6b8cac9)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“app”:“/Users/michael.gallacher/SonosApps/Sonos-resigned.ipa”,“bundleId”:“com.sonos.SonosController”,“platformName”:“iOS”,“udid”:“e87ddab3bca9c43164792f0d5bc0f2a1ee142ee3”,“deviceName”:“Mike’s iPhone”,“autoAcceptAlerts”:true}}
info: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)
info: [debug] Using local .ipa from desired caps: /Users/michael.gallacher/SonosApps/Sonos-resigned.ipa
info: [debug] Copying local zip to tmp dir
info: [debug] /Users/michael.gallacher/SonosApps/Sonos-resigned.ipa copied to /var/folders/_b/47ly3g0d19b22h_m5zhy05nx9chygr/T/11522-23349-am5rgm/appium-app.zip
info: [debug] Unzipping /var/folders/_b/47ly3g0d19b22h_m5zhy05nx9chygr/T/11522-23349-am5rgm/appium-app.zip
info: [debug] Testing zip archive: /var/folders/_b/47ly3g0d19b22h_m5zhy05nx9chygr/T/11522-23349-am5rgm/appium-app.zip
info: [debug] Zip archive tested clean
info: [debug] Unzip successful
info: [debug] Using locally extracted app: /var/folders/_b/47ly3g0d19b22h_m5zhy05nx9chygr/T/11522-23349-am5rgm/Payload/Sonos.app
info: [debug] Creating new appium session e5415c89-ef4b-4b85-bdc7-9938db1e1145
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] Not checking whether simulator is available since we’re on a real device
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Parsed app Localizable.strings
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/michael.gallacher/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {“nodePath”:“/usr/local/Cellar/node/0.12.0/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”:true,“autoDismissAlerts”:false,“sendKeyStrategy”:“grouped”}
…o: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
info: [debug] Dynamic bootstrap path: /Users/michael.gallacher/Library/Application Support/appium/bootstrap/bootstrap-0a43fee480e6ded5.js
info: [debug] Reusing dynamic bootstrap: /Users/michael.gallacher/Library/Application Support/appium/bootstrap/bootstrap-0a43fee480e6ded5.js
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“6.1.1”,“iOSSDKVersion”:“8.1”,“deviceName”:“Mike’s iPhone”,“platformVersion”:null}
info: [debug] fixDevice is on
info: [debug] Final device string is: ‘Mike’s iPhone (8.1 Simulator)’
info: [debug] Not setting device type since we’re on a real device
info: [debug] Checking whether we need to set app preferences
info: [debug] Not setting iOS and app preferences since we’re on a real device
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] On a real device; cannot clean device state
info: [debug] Not setting locale because we’re using a real device
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS device log capture via deviceconsole
info: [debug] Not pre-launching simulator
info: [debug] Creating iDevice object with udid e87ddab3bca9c43164792f0d5bc0f2a1ee142ee3
info: [debug] Checking app install status using: /usr/local/lib/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id e87ddab3bca9c43164792f0d5bc0f2a1ee142ee3 --bundle com.sonos.SonosController
info: [debug] App is not installed. Will try to install the app.
info: [debug] Installing ipa found at /Users/michael.gallacher/SonosApps/Sonos-resigned.ipa
info: [debug] Creating iDevice object with udid e87ddab3bca9c43164792f0d5bc0f2a1ee142ee3
info: [debug] Nothing found on device, going ahead and installing.

At this point, my colleague’s server log spews a whole bunch of info from the target device. Example:

info → GET /wd/hub/status {}
info [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.5”,“revision”:“a124a15677e26b33db16e81c4b3b34d9c6b8cac9”},“isShuttingDown”:false},“sessionId”:“9623e090-d102-4e99-a43b-dd29bff7ff6a”}

info ← GET /wd/hub/status cf3 200cf1 7.610 ms - 178 {“status”:0,“value”:{“build”:{“version”:“1.3.5”,“revision”:“a124a15677e26b33db16e81c4b3b34d9c6b8cac9”},“isShuttingDown”:false},“sessionId”:“9623e090-d102-4e99-a43b-dd29bff7ff6a”}

info [IOS_SYSLOG_ROW ] Feb 27 22:02:57 Hugos-iPad syslog_relay[2546] : syslog_relay found the ASL prompt. Starting…

My log continues as follows:

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 real device with UDID e87ddab3bca9c43164792f0d5bc0f2a1ee142ee3
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 e87ddab3bca9c43164792f0d5bc0f2a1ee142ee3 com.sonos.SonosController -e UIASCRIPT “/Users/michael.gallacher/Library/Application Support/appium/bootstrap/bootstrap-0a43fee480e6ded5.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {“global”:90000}
info: [debug] [INST STDERR] 2015-03-02 15:55:47.586 instruments[23393:472850] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 4.) : Failed to launch process with bundle identifier ‘com.sonos.SonosController’
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

Instruments tries a few more times and then the process aborts.

Thanks for any suggestions,
Mike

Resolution: The fix turned out to be manually installing ideviceinstaller with brew.