Inconsistent Behaviour in HKWorkoutSessionDelegate Method on watchOS 10.0 and Higher

Hello developers,

I hope you're all doing well. I've encountered an issue that I'm struggling to resolve, and I'd greatly appreciate any insights or assistance you can offer.

Issue Summary: In my watchOS app, I'm utilizing the HKWorkoutSessionDelegate protocol and the workoutSession(_:didFailWithError:) method. While everything works smoothly on watchOS 9.*, I'm facing a problematic inconsistency on watchOS 10.0 and higher.

Steps to Reproduce:

  1. Create a new watchOS project with a deployment target of watchOS 10.0 or higher.
  2. Implement the HKWorkoutSessionDelegate protocol and the workoutSession(_:didFailWithError:) method.
  3. Attempt to start a workout session.

Expected Behavior: I expect the workout session to commence without any issues, and the delegate method to gracefully handle any errors, without displaying an error message.

Actual Behavior: Unfortunately, on watchOS 10.0 and higher, my attempts to initiate a workout session result in an error message: "Cannot start workout session while process is in the background."

Version/Build:

  • Affected watchOS versions: 10.0 and higher
  • Non-affected watchOS versions: 9.*

Reproducibility: I've confirmed that this issue is reproducible across different projects and on different simulators running watchOS 10.0 and higher.

Additional Information: This inconsistency seems to be specific to watchOS versions 10.0 and higher and doesn't occur on watchOS 9.*. It's causing confusion and hampering my development process, and the error message isn't as informative as I'd like.

Workaround: I've been unable to identify a workaround for this issue so far. If any of you have insights, solutions, or suggestions, I'd be grateful for your input.

Please feel free to share your experiences and thoughts on this matter. Your help is greatly appreciated!

Thank you for your time and assistance.

Best regards, Leonid

Post not yet marked as solved Up vote post of GrebenyukLA Down vote post of GrebenyukLA
275 views