failed to attach to process - debuggin in simulators

So I followed the instructions for debugging simultaneously in the simulators


https://developer.apple.com/library/prerelease/watchos/documentation/General/Conceptual/AppleWatch2TransitionGuide/ConfiguretheXcodeProject.html#//apple_ref/doc/uid/TP40015234-CH5-SW1


Building, Running, and Debugging Your New App

When you create a Watch app target for watchOS 2, Xcode automatically creates the necessary build schemes to run and debug each of your app’s interfaces in the simulator. Xcode provides separate simulators for Apple Watch and iOS devices so that you can debug your Watch app and iOS app at the same time. When you build and run your Watch app, Xcode automatically launches both simulators but only begins a debugging session for your Watch app.

To debug your iPhone app at the same time as your Watch app


  1. Build and run your Watch app.

  2. Select a build scheme for your iPhone app.

  3. Click Run to run your iPhone app.

    Xcode launches your iPhone app in the simulator and adds it to the debugging pane.


I've also reset my Mac, reset the simulators, cleaned out the dervied data and other temp files related to xcode, and I keep getting the same thing over and over again.


I run my watch app, it opens in the simulator. I select the scheme for my ios app, run it, and every time I get this


error failed to attach to process ID XXXX


I can debug one at a time.... the watch app or the phone app, but that is really inefficient...


am I the only one with this issue?

@zacware,


I am using the following steps to debug the watch and iphone at the same time.


1) Create a scheme with both watch and phone combination.


2) Build successfully with command B.


2) Setup breakpoints that are shown to be active in the simulator. Typically in the send and receive message methods of each device.


3) Run the scheme above which starts up the watch simulator (running) and creates an iphone simulator.


4) Look for the icon for my app in the iphone simulator and click it to run the iphone app.


5) Go back to Xcode debug->attach to process and find the pid for my app and attach to it.


Hope this helps.

KellyM

First, thank you very much for taking the time to reply.


I'm glad to see it is working for someone, I did try your workflow and everything is OK but I never see any debug output from the iphone app even though after attaching the PID I can switch the debug pane back and forth between the watch extension and the phone app. The watch extension continues to show debug output, but even though the iphone app process is selectable, and shows me status on CPU and memory usage for both, it does not output any of my debug messages on the phone side of things if I switch the debug pane popup menu to show phone debug messages.


My only workaround is to switch the executable in the scheme from the watch app to the phone app, then I can debug the phone side. To go back to editng the watch side, I have to change the executable and re-build. So I can debug one or the other, but not both at the same time.


Since it works for you however, it must work, so perhaps I have a setting wrong somewhere. I will continue to mess around with it and see if I can figure it out and if I do I will post what was wrong with my setup.


Thanks again for the help


Steve

@Steve,


Glad to help.


Your summary makes some good points that I'm seeing in my configuration also. (I haven't been able to see the logs from the iphone side

in the debugger. I only see the logs from the watch side.)


Some very old posts talk about using the console logs to see the output from the iphone. (iphone simulator ->open->system log)

But I haven't gotten that to work yet.


One suggestion would be to add Xcode Debugger and Simulator to the keyword tags in your post above and hopefully someone can give

an update on how to do this in the current release.

failed to attach to process - debuggin in simulators
 
 
Q