WCSession detect watch powered off. HealthKit startWatchApp hangs

  1. Install app on phone and watch
  2. Power the watch off

Run the app on the phone.

WCSession.default.isWatchAppInstalled == true WCSession.isSupported() == true WCSession.default.isPaired == true WCSession.default.activationState == .activated

Now I try to run HKHealthStore startWatchApp.

The startWatchApp method's completion never fires.

I'd like to detect that the watch is powered off, so then I do not try to run the startWatchApp method. I can't see a way to detect that the watch is powered off.

Alternatively - I'd like startWatchApp to quickly fail, or - to have some way of cancelling it if it doesn't return quickly.

Any ideas please?

Replies

I've been using WCSession.default.isReachable before I start anything with the watch, which seems to catch the powered off state, in addition to theoretically any state in which the app cannot reach the watch. Might be worth giving that a shot. The other check I use is WCSession.default.isWatchAppInstalled, which is true even if your app can't currently reach the watch, presumably since the Watch app on the phone would know what's installed and what isn't.