How to attach debugger to iOS app after launch?

Locksleyu picture Locksleyu · Mar 15, 2012 · Viewed 75.4k times · Source

I have an issue I am troubleshooting which occurs very infrequently and doesn't seem to happen when I have things running under Xcode.

Is it possible to run an app normally (i.e. from Springboard) until my issue occurs, and then attach a debugger at that point?

I would prefer to do this without jailbreaking if possible.

Answer

Ole Begemann picture Ole Begemann · Mar 15, 2012
  • Attach your device connected your Mac
  • Debug > Attach to Process by PID or Name
  • In the dialog sheet, enter the name of your app as it appears in the Debug navigator when started via Xcode.

If the app is already running, the debugger will attach to the running process. If it isn't running, it will wait for the app to launch and then attach.