Debugging communications between iPhone & Mac

I am developing an app that is to be runnable on both Mac Studio, and iPhone 14. The app instance on the Mac communicates with the app's other instance in the iPhone 14.

To debug the Bonjour communications I need to run this source code in the debugger in both the Mac Studio simulator, and at the iPhone, simultaneously. The ideal would be to able to step through source code, and set break points, in each app instance simultaneously. Is that possible? If so how?

Replies

The ideal would be to able to step through source code, and set break points, in each app instance simultaneously. Is that possible?

Yes.

If so how?

Something like:

  1. Set the run destination to your iPhone.

  2. Run the app.

  3. Set the run destination to your Mac.

  4. Run the app.

You can now switch between instances using the popup in the debug area.

Having said that, IME debugging networking code in the debugger is tricky because a lot of the issues are time based. I generally approach problems like this using a combination of unit tests [1] and logging [2].

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Where I isolate the unit test from the network, as discussed here.

[2] Using the syslog; see Your Friend the System Log.