Unable to execute the code on iOS real device

Launching Appium with command: ‘/Applications/Appium.app/Contents/Resources/node/bin/node’ lib/server/main.js --command-timeout “7200” --platform-version “8.0” --platform-name “iOS” --udid “88cd21ec190c8d26c22ccdd7fdd0bded403fd16d” --no-reset --show-ios-log --default-device

info: Welcome to Appium v1.3.7 (REV 72fbfaa116d3d9f6a862600ee99cf02f6d0e2182)

info: Appium REST http interface listener started on 0.0.0.0:4723
info: [debug] Non-default server args: {“udid”:“88cd21ec190c8d26c22ccdd7fdd0bded403fd16d”,“noReset”:true,“platformName”:“iOS”,“platformVersion”:“8.0”,“defaultDevice”:true,“showIOSLog”:true,“defaultCommandTimeout”:7200}

info: Console LogLevel: debug

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”}}}

info: <-- GET /wd/hub/status 200 11.711 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”}}}

info: <-- GET /wd/hub/status 200 4.712 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”}}}

info: --> POST /wd/hub/session {“desiredCapabilities”:{“app”:“settings”,“appium-version”:“1.0”,“platformVersion”:“8.2”,“udid”:“88cd21ec190c8d26c22ccdd7fdd0bded403fd16d”,“platformName”:“iOS”,“deviceName”:“MAG Device Library iPad4 #24”}}

info: Client User-Agent string: Apache-HttpClient/4.3.6 (java 1.5)

info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : appium-version
info: [debug] We’re on iOS8+ so not copying preferences app
info: [debug] Creating new appium session b00dce10-948e-4dce-85ac-453f77ba6384
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.2
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] Localizable.strings is not currently supported when using real devices.
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/stig/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {“nodePath”:"/Applications/Appium.app/Contents/Resources/node/bin/node",“commandProxyClientPath”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“grouped”}
info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

info: [debug] Dynamic bootstrap path: /Users/stig/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.js
info: [debug] Reusing dynamic bootstrap: /Users/stig/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.js
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“6.2”,“iOSSDKVersion”:“8.2”,“deviceName”:“MAG Device Library iPad4 #24”,“platformVersion”:“8.2”}
info: [debug] fixDevice is on
info: [debug] Final device string is: ‘MAG Device Library iPad4 #24 (8.2 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] Reset not set, not ending sim or cleaning up app 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 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d
info: [debug] Checking app install status using: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d --bundle com.apple.Preferences

info: [debug] App is installed.

info: [debug] fullReset not requested. No need to install.
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 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d
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 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d com.apple.Preferences -e UIASCRIPT “/Users/stig/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {“global”:90000}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“b00dce10-948e-4dce-85ac-453f77ba6384”}
info: <-- GET /wd/hub/status 200 2.041 ms - 178 {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“b00dce10-948e-4dce-85ac-453f77ba6384”}

info: [debug] [INST STDERR] 2015-04-06 16:59:33.002 instruments[43538:1097111] WebKit Threading Violation - initial use of WebKit from a secondary thread.

info: [debug] [INST STDERR] Instruments Usage Error : Specified target process is invalid: com.apple.Preferences

info: [debug] [INST STDERR] instruments, version 6.2 (56718)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]

info: [debug] [INSTSERVER] Instruments exited with code 255
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: [IOS_SYSLOG_ROW ] Apr 6 16:59:33 MAG-Device-Library-iPad4-27 DTMobileIS[1208] : Could not create service named com.apple.instruments.server.services.device.xpccontrol

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:33 MAG-Device-Library-iPad4-27 DTMobileIS[1208] : Could not create service named com.apple.instruments.server.services.launchdaemon

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:33 MAG-Device-Library-iPad4-27 DTMobileIS[1208] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
info: [IOS_SYSLOG_ROW ] Apr 6 16:59:33 MAG-Device-Library-iPad4-27 DTMobileIS[1208] : Could not create service named com.apple.instruments.server.services.device.applictionListing
info: [IOS_SYSLOG_ROW ] Apr 6 16:59:33 MAG-Device-Library-iPad4-27 DTMobileIS[1208] : Could not create service named com.apple.dt.Xcode.WatchProcessControl

info: Launching instruments

info: [debug] Attempting to run app on real device with UDID 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d
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 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d com.apple.Preferences -e UIASCRIPT “/Users/stig/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.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-04-06 16:59:38.811 instruments[43543:1097205] WebKit Threading Violation - initial use of WebKit from a secondary thread.

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:39 MAG-Device-Library-iPad4-27 DTMobileIS[1210] : Could not create service named com.apple.instruments.server.services.launchdaemon

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:39 MAG-Device-Library-iPad4-27 DTMobileIS[1210] : Could not create service named com.apple.instruments.server.services.device.xpccontrol

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:39 MAG-Device-Library-iPad4-27 DTMobileIS[1210] : Could not create service named com.apple.instruments.server.services.device.applictionListing
info: [IOS_SYSLOG_ROW ] Apr 6 16:59:39 MAG-Device-Library-iPad4-27 DTMobileIS[1210] : Could not create service named com.apple.dt.Xcode.WatchProcessControl
info: [IOS_SYSLOG_ROW ] Apr 6 16:59:39 MAG-Device-Library-iPad4-27 DTMobileIS[1210] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn

info: [debug] [INST STDERR] Instruments Usage Error : Specified target process is invalid: com.apple.Preferences
instruments, version 6.2 (56718)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]

info: [debug] [INSTSERVER] Instruments exited with code 255
info: [debug] Killall instruments

info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #2
info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on real device with UDID 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d

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 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d com.apple.Preferences -e UIASCRIPT “/Users/stig/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.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-04-06 16:59:44.782 instruments[43546:1097282] WebKit Threading Violation - initial use of WebKit from a secondary thread.

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:44 MAG-Device-Library-iPad4-27 DTMobileIS[1212] : Could not create service named com.apple.instruments.server.services.launchdaemon

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:44 MAG-Device-Library-iPad4-27 DTMobileIS[1212] : Could not create service named com.apple.instruments.server.services.device.xpccontrol

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:44 MAG-Device-Library-iPad4-27 DTMobileIS[1212] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
info: [IOS_SYSLOG_ROW ] Apr 6 16:59:44 MAG-Device-Library-iPad4-27 DTMobileIS[1212] : Could not create service named com.apple.instruments.server.services.device.applictionListing
info: [IOS_SYSLOG_ROW ] Apr 6 16:59:45 MAG-Device-Library-iPad4-27 DTMobileIS[1212] : Could not create service named com.apple.dt.Xcode.WatchProcessControl

info: [debug] [INST STDERR] Instruments Usage Error : Specified target process is invalid: com.apple.Preferences
info: [debug] [INST STDERR] instruments, version 6.2 (56718)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]
info: [debug] [INSTSERVER] Instruments exited with code 255
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #3
info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on real device with UDID 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d
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 88cd21ec190c8d26c22ccdd7fdd0bded403fd16d com.apple.Preferences -e UIASCRIPT “/Users/stig/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.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-04-06 16:59:50.614 instruments[43551:1097315] WebKit Threading Violation - initial use of WebKit from a secondary thread.

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:50 MAG-Device-Library-iPad4-27 DTMobileIS[1214] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:50 MAG-Device-Library-iPad4-27 DTMobileIS[1214] : Could not create service named com.apple.instruments.server.services.device.xpccontrol
info: [IOS_SYSLOG_ROW ] Apr 6 16:59:50 MAG-Device-Library-iPad4-27 DTMobileIS[1214] : Could not create service named com.apple.instruments.server.services.launchdaemon
info: [IOS_SYSLOG_ROW ] Apr 6 16:59:50 MAG-Device-Library-iPad4-27 DTMobileIS[1214] : Could not create service named com.apple.instruments.server.services.device.applictionListing

info: [IOS_SYSLOG_ROW ] Apr 6 16:59:50 MAG-Device-Library-iPad4-27 DTMobileIS[1214] : Could not create service named com.apple.dt.Xcode.WatchProcessControl

info: [debug] [INST STDERR] Instruments Usage Error : Specified target process is invalid: com.apple.Preferences
info: [debug] [INST STDERR] instruments, version 6.2 (56718)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]

error: Failed to start an Appium session, err was: Error: Instruments crashed on startup

info: [debug] [INSTSERVER] Instruments exited with code 255
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
info: [debug] Stopping iOS log capture
info: [debug] Reset not set, not ending sim or cleaning up app state
info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:389:31)
at null. (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:308:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Instruments crashed on startup)”,“origValue”:“Instruments crashed on startup”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 20083.062 ms - 182

Make sure your device has Instruments enabled (Settings -> Devloper -> Enable UI Automation) and XCode is synchronized with the device.

Please make sure UI automation is enabled in the device and also you need take a developement and debug build form the devloper.

These two things are mnadatory for executing on real iOS device.

This is your problem. You will get much better advice on this board if you actually explain what you are trying to do. Are you trying to automate ‘settings’ on the iDevice? This will not work.