Simultaneous debugging of watch and iPhone app - debugPrints in iPhone app not showing in console

I'm using XCode Version 10.1 to develop a watch app and an iPhone app with Swift 4.2. I'm trying to set up a connection between the two, and I need a way to debug both the watch app and iPhone app at the same time (I'm using my real Apple Watch and iPhone and not the simulator). I found a great description in a previous post on how to do this (first build and run the WatchKit app, then change target to the iOS app, tap the app's icon in the iPhone and then attach the iOS app process to the debugger). Although the breakpoints set in my iPhone app now gets triggered, the console output window for my iPhone app won't show any debugPrints set in the iPhone app.


Does anyone have a solution to this?

Accepted Reply

Ok, so I think I found a solution. After following the description in this post (first build and run the WatchKit app, then change target to the iOS app, tap the app's icon in the iPhone and then attach the iOS app process to the debugger), make sure the iOS app is selected in the scheme selector, build+run the iOS app again so it is rebuilt. Now you should be able to see debug prints from both the watch app and the iPhone app, when switching between them in the console pane. Not sure why you have to do this though.


Update:

Seems like the only thing you need to do after starting the Watchkit app is to change target to the iOS app and rerun it so it opens up automatically on your phone. So no need to first attach it manually to the debugger.

Replies

Are you switching the popup in the console pane to the right app?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yes, even if I switch to the iPhone app in the console pane, it shows no debug prints, just blank. But the debug prints for my Watch App show when I switch to that process in the console pane. Wonder why this is..

Ok, so I think I found a solution. After following the description in this post (first build and run the WatchKit app, then change target to the iOS app, tap the app's icon in the iPhone and then attach the iOS app process to the debugger), make sure the iOS app is selected in the scheme selector, build+run the iOS app again so it is rebuilt. Now you should be able to see debug prints from both the watch app and the iPhone app, when switching between them in the console pane. Not sure why you have to do this though.


Update:

Seems like the only thing you need to do after starting the Watchkit app is to change target to the iOS app and rerun it so it opens up automatically on your phone. So no need to first attach it manually to the debugger.