Debugging Apple Watch Connectivity with Console

In debugging Apple Watch apps and their communication with the parent iOS app I have needed to access the logs of both simulated devices in the same debugging session.

Xcode 8 will run one debugging session and the Watch simulator will launch the iOS Simulator to communicate its iOS app which precludes using the iOS Simulator for debugging and logs. In the other direction the iOS Simulator will kill and then install the watch app at the start of its build and run (observe this from the Watch’s home screen). Building and running either app prevents running both at the same time. Without having tried the GM, (I know, I know) Xcode 9 should be an improvement on this in automated and manual testing.

Running two debug sessions on physical devices runs into the same problem of the iOS app re-installing the watch app when running from Xcode. To work around this the Console application (truly will allow you to observe and capture logs from a given process or even device.

  1. Start by installing the app as on the phone simulator and open the watch simulator
  2. Open Console, select a device in the Sources list (left column) and then search for your process name.
  3. Build and run the watch app.
  4. Manually open the phone app within its simulator.
  5. Ta-da, observe the phone logs in Console and the watch logs in Xcode (or Console).

For Swift developers you may need to start using NSLog again as only NSLog is directed to the Apple System Log (man 3 asl and man syslog). Swift’s print is great but not as helpful here.