How to Debug iPhone-Watch Connectivity Without Log Noise

Cross-device bugs are hard because events arrive late, duplicated, or out of order. If logs are inconsistent, debugging becomes guesswork. Let’s build logs that actually answer questions.

Step 1: Add a shared trace ID per command

struct DeviceCommand: Codable {
    let traceId: String
    let type: String
    let sentAtMs: Int64
    let payload: [String: String]
}

Step 2: Log lifecycle milestones on both devices

logger.info("send trace=\(cmd.traceId) type=\(cmd.type)")
logger.info("ack trace=\(cmd.traceId) status=ok")

Step 3: Build a merged timeline viewer for replay

[
  {"trace":"a-104","side":"phone","event":"send","t":1710123001},
  {"trace":"a-104","side":"watch","event":"recv","t":1710123002}
]

Common pitfall

Logging free-text messages without stable IDs. You can read them, but you cannot correlate them.

What to check

  • Each sent command has one receive and one ack entry.
  • Duplicate deliveries are visible as same trace ID.
  • Out-of-order events are obvious in merged timeline.

Get New Tutorials by Email

No spam. Just clear, practical breakdowns you can apply right away.

Enjoy this tutorial?

Get new practical tech tutorials in your inbox.