Possible to Debug both Watch and iPhone simultaneously?

I can debug either the watch app or the iPhone app in the simulator, easy enough.


Is there a way to have the debugger running for both simultaneously? This becomes somewhat of an issue when testing WatchConnectivity.


If you run either target, it replaces the other target in the debugger.

Accepted Reply

The WWDC talk Building Watch Apps discusses how to do this.


Basically select the Watch App as the scheme in xcode, hit build+run which will build the iOS app and WatchKit app, install the WatchKit app on to the Watch and attach the debugger to the WatchKit Extension. Then in xcode select the iOS app in the scheme selector and select the iPhone as the target device, launch the iOS app by tapping the app icon on the phone and in xcode in the menu bar select "Debug > Attach to Process" and select your app in the list. This should result in having xcode attached to both processes at the same time.

If you want to debug something early in the iOS app's lifecycle you can select "Debug > Attach to Process by PID or Name..." and type in the process name of the iOS app prior to launching it manually. This way the debugger will be attached right when the app launches.


Hope that helps

Replies

I am able to be running both in one simulator target run. When you run the WatchKit App target it shows me both a Watch screen with the Watch app running, then there is also an iPhone simulator screen running, and if I click on the icon for my app it will also start running. I think that is what you are looking for.


Mark

Sure I can run them both at the same time, but I want to debug both at the same time. The debugger is only attached to one process at a time.

The WWDC talk Building Watch Apps discusses how to do this.


Basically select the Watch App as the scheme in xcode, hit build+run which will build the iOS app and WatchKit app, install the WatchKit app on to the Watch and attach the debugger to the WatchKit Extension. Then in xcode select the iOS app in the scheme selector and select the iPhone as the target device, launch the iOS app by tapping the app icon on the phone and in xcode in the menu bar select "Debug > Attach to Process" and select your app in the list. This should result in having xcode attached to both processes at the same time.

If you want to debug something early in the iOS app's lifecycle you can select "Debug > Attach to Process by PID or Name..." and type in the process name of the iOS app prior to launching it manually. This way the debugger will be attached right when the app launches.


Hope that helps

Interesting. I didn't have to do anything different than what I put. I can put break points in either Watch or iPhone apps running simultaneously. And all I did was select the WakthKitApp and then it shows both iPhone and Apple Watch. "iPhone 6 Plus + Apple Watch - 42mm" and hit run.


Mark