How to get UIAutomation, Simulator, and Xcode Debugger Running at the same time?

懵懂的女人 提交于 2019-12-03 08:41:03

This stumped me for a while, too -- especially since when the Automation Instrument is selected, the Instruments application explicitly says Current instrumentation disallows attach. The key is to realize that an app running in the simulator is visible in your host system as its own process, so attaching directly from GDB works well. These instructions are for XCode 4.2 (4C199) on Snow Leopard 10.6.8:

  1. Start your test in Instruments however you normally do (either directly from Instruments, or from Xcode 4's Product -> Profile. Pick whatever templates and scripts to get your automated test underway.

  2. Back in Xcode, under the menu Product -> Attach to Process, you should see your iOS app, listed by name, alongside all the other applications on your host computer. In fact, it very likely will be listed first, under the section header Likely Targets.

  3. If it's not visible, choose View -> Debug Area -> Show Debug Area so you can see the gdb console.

  4. Hit the pause button (Product -> Debug -> Pause) to interrupt your program. Set breakpoints, inspect, as usual.

Then next question is: why can't I see my normal NSLog() output in the debugger console? Your app already bound itself to the console output streams, so the simplest place to look for its output is in OS X Console app (/Applications/Utilities/Console.app) and look under DATABASE SEARCHES -> All Messages.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!