Observe watchOS app and iPhone app’s log at the same time.

When I was developing an Apple Watch app, I tried so many ways to figure out what’s happening between watch app and iPhone app. What and when a query send from watch to iPhone? And when the other side receive the query?

Finally, I find out the way and wirte down a shell script. This script can tail Apple watch simulator’s console log and iPhone simulator’s console log at the same time. And without too many procedure.

How to use it?

  1. Download that script as a file. (i.e. tailTogether.sh)
  2. Run your watch app on your mac. Ensure iPhone simulator and watch simulator are running.
  3. Launch that script. ($ sh tailTogether.sh)
  4. Done. We can observe watch app and iPhone app’s log in one terminal screen now.

P.S. Use NSLog(), not print() in your project’s code.