我使用以下命令在设备(不是模拟器)上启动我的 iOS 应用程序(应用程序已安装)。
instruments \
-w c717fa22472d7b691ae5763af90e1e44244ad85a \
-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
-D "/Users/mj/Desktop/apps/trace" \
LPSimpleExample-cal \
-e UIARESULTSPATH /Users/mj/Desktop/apps \
-e UIASCRIPT /Users/mj/Desktop/apps/_run_loop.js
10 次中有 6 次有效。如果出现错误,我会收到以下消息:
2013-10-07 16:45:51.553 instruments[9891:1207] unable to locate CFBundleIdentifier for path: LPSimpleExample-cal
2013-10-07 16:45:51.555 instruments[9891:1207] Recording cancelled : At least one target failed to launch; aborting run
Instruments Trace Error : Error Domain=com.apple.instruments Code=1 "Error Starting Recording" UserInfo=0x7faccbef8fa0 {NSLocalizedDescription=Error Starting Recording, NSLocalizedRecoverySuggestion=At least one target failed to launch; aborting run}
Instruments Trace Error : Failed to start trace.
对我来说,仪器似乎在这里有一个错误。我尝试在不同的场景中启动该应用程序超过 100 次,但我无法分析错误模式。设备崩溃日志说:
Process: DTMobileIS [34956]
Path: /Developer/Library/Daemons/DTMobileIS
Identifier: DTMobileIS
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: lockbot [34938]
Date/Time: 2013-10-07 15:29:05.474 -0700
OS Version: iOS 6.1.3 (10B329)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
异常类型EXC_BAD_ACCESS (SIGSEGV)
表示正在访问的对象已被释放。ASIGSEGV
是分段错误,这意味着您正在尝试访问无效的内存地址。参考:iOS 崩溃日志中的异常类型
除了使用 bundleIdentifier,我还尝试指定完整的应用程序路径或完整的 bundleIdentifier:
# with full app path
instruments \
-w c717fa22472d7b691ae5763af90e1e44244ad85a \
-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
-D "/Users/mj/Desktop/apps/trace" \
/Users/mj/Desktop/apps/LPSimpleExample-cal.app \
-e UIARESULTSPATH /Users/mj/Desktop/apps \
-e UIASCRIPT /Users/mj/Desktop/apps/_run_loop.js
# with full bundleIdentifier
instruments \
-w c717fa22472d7b691ae5763af90e1e44244ad85a \
-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
-D "/Users/mj/Desktop/apps/trace" \
/Users/mj/Desktop/apps/LPSimpleExample-cal.app \
-e UIARESULTSPATH /Users/mj/Desktop/apps \
-e UIASCRIPT /Users/mj/Desktop/apps/_run_loop.js
配置详情
- 仪器版本:5.0 (51166)
- XCode 版本:5.0 (5A1413)
- 设备类型:iPhone 5 - 6.1.3、iPhone 5C - 7.02、iPhone 5S - 7.0.2
在哪些情况下仪器无法在设备上启动应用程序或您何时收到错误消息,是否有更多信息unable to locate CFBundleIdentifier for path: LPSimpleExample-cal
?