I have a very simple workout app I'm working on for Apple Watch. It uses Health Kit to start and end workouts, my only problem is that when I try to end the workout it usually doesn't end the session and I get this error
2020-07-22 12:27:46.547720-0700 5k WatchKit Extension[25774:944527] [workouts] <HKWorkoutSession:0x80156310 A54AF52C-8B08-4BAD-A28C-03D8E54044B5 ended>: Failed to end: Error Domain=com.apple.healthkit Code=3 "Unable to transition to the desired state from the Ended(3) state (event 6). Allowed transitions from the current state are: {
7 = "<error(7): Ended(3) -> Ended(3)>";
}" UserInfo={NSLocalizedDescription=Unable to transition to the desired state from the Ended(3) state (event 6). Allowed transitions from the current state are: {
7 = "<error(7): Ended(3) -> Ended(3)>";
}}
I'm really not even sure where to start looking for the problem from this information, nor do I know what it means. Also, usually on the 4th or 5th try, it will actually end the workout session.