Reputation: 4946
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?
Upvotes: 12
Views: 8007
Reputation: 34175
Xcode debug app after launch
after that you will see in Debug navigator that debugger is waiting for attach(if app is removed from memory)
Upvotes: -1
Reputation: 3101
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.
Upvotes: 3
Reputation: 135540
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.
Upvotes: 24