我的环境是:
mac:10.12.1
xcode:7.3.1
appium:1.6.3
用脚本启动的 appium 测试 IOS

报错信息如下:

HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"com.JDVideo","platformVersion":"9.0","browserName":"","platformName":"iOS","udid":"65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562","deviceName":"iphone 5s"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"com.JDVideo","platformVersion":"9.0","browserName":"","platformName":"iOS","udid":"65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562","deviceName":"iphone 5s"},null,null,null,null,null,null,null,null]
[Appium] Creating new IosDriver session
[Appium] Capabilities:
[Appium]   app: 'com.JDVideo'
[Appium]   platformVersion: '9.0'
[Appium]   browserName: ''
[Appium]   platformName: 'iOS'
[Appium]   udid: '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[Appium]   deviceName: 'iphone 5s'
[debug] [iOS] IosDriver version: 1.13.2
[BaseDriver] Session created with session id: 85813bbf-2414-4633-9078-198f40fbd599
[debug] [iOS] Xcode version set to 7.3.1
[debug] [iOS] Not auto-detecting udid.
[debug] [iOS] App is an iOS bundle, will attempt to run as pre-existing
[debug] [iOS] Removing any remaining instruments sockets
[debug] [iOS] Cleaned up instruments socket /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/instruments_sock
[debug] [iOS] No language specified. Using default strings
[debug] [iOS] Strings file not found. Looking in 'en.lproj' directory
[iOS] Could not file localizable strings file 'Localizable.strings'!
[debug] [iOS] Creating instruments
[debug] [UIAuto] Preparing bootstrap code
[debug] [UIAuto] Dynamic bootstrap dir: /Users/yefengjun/Library/Application Support/appium/bootstrap
[debug] [UIAuto] Dynamic env: {"nodePath":"/usr/local/bin/node","commandProxyClientPath":"/Users/yefengjun/Downloads/appium/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js","instrumentsSock":"/var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"grouped"}
...bug] [UIAuto] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
[debug] [UIAuto] Dynamic bootstrap path: /Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js
[debug] [UIAuto] Reusing dynamic bootstrap: /Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js
[debug] [iOS] Creating iDevice object with udid 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562
[debug] [iOS] Running ios real device reset flow
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Found idevicesyslog: '/usr/local/bin/idevicesyslog'
[debug] [iOS] App is installed.
[debug] [iOS] fullReset not requested. No need to install.
[debug] [iOS] Starting UIAutoClient, and launching Instruments.
[debug] [UIAuto] Instruments socket server started at /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/instruments_sock
[debug] [Instruments] Instruments is at: /Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments
[debug] [Instruments] Attempting to launch instruments, this is try #1
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:13.193 instruments[15991:1450929] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[debug] [Instruments] Attempting to launch instruments, this is try #2
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:19.877 instruments[15998:1451729] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[debug] [Instruments] Attempting to launch instruments, this is try #3
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:26.681 instruments[16003:1452405] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[debug] [Instruments] Attempting to launch instruments, this is try #4
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:33.270 instruments[16010:1452886] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[debug] [Instruments] Attempting to launch instruments, this is try #5
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:39.950 instruments[16018:1453679] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[Instruments] Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at Instruments.launch$ (../../lib/instruments.js:223:15)
    at tryCatch (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
 Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at Instruments.launch$ (../../lib/instruments.js:223:15)
    at tryCatch (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at Instruments.launch$ (../../lib/instruments.js:223:15)
    at tryCatch (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session 500 30300 ms - 232 

脚本代码:

DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability("platformName","IOS");
        capabilities.setCapability("app","com.JDVideo");
        capabilities.setCapability("deviceName","iphone 5s");
        capabilities.setCapability("platformVersion", "9.0");
        capabilities.setCapability("udid","65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562");
        driver =new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities);

各位大神帮忙看一下吧...调试了好几天了一直被这问题困着进行不下去


↙↙↙阅读原文可查看相关链接,并与作者交流