I have a very specific case that I need to debug. I need to examine what is happening when an application is relaunched after being killed (looking at what stored data is being read, etc.). If I kill the application from the device, the debugger stops (which makes sense).
The best method I can think of is killing the application, and re-launching from Xcode (without modifying any code). I am trying to investigate "real world" behaviour. Is this the best approach for my case, or is there another way to view what happening with Xcode?
In the Scheme editor in Xcode, you can edit the Debug profile to have the debugger "Wait for XY.app to launch". If you then select Product -> Run, the debugger should wait until you launch the app manually on the device and then automatically attach to the running process.
If you want to avoid the build & run phase altogether / changing build configs, you can achieve a cold-start reattach by:
Attach to Process by PID or Name...
Attach
You'll then see "Waiting to attach to APPNAME on somedevice", and you can just reopen the app on the simulator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With