kelin
kelin

Reputation: 11974

Running HKWorkoutSession causes native Workout app to crash

I have an app that uses HKWorkoutSession. This app also support background modes. It uses HealthKit only to notify user in set intervals and doesn't collect any data.

Everything works fine, if it running alone, but if a user follows the next steps:

  1. Start native Workout app
  2. Start my app
  3. Go back to native Workout

Apple Workout app crashes. Does anybody have an idea why?

There is also another scenario. If user starts my app first and then native app, my app refuses to work in background.

Bug takes place on watchOS 3.

Upvotes: 0

Views: 488

Answers (1)

immadbananas
immadbananas

Reputation: 309

Unfortunately, you can't have two simultaneous HKWorkout sessions running at the same time. So starting a new HKWorkout session (such as on your app) ends another pre-existing HKWorkout session (such as on the native Workout app). I don't believe either app should crash if this occurs, based on personal experience. I believe the crash may have something to do with the way you are handling either the start or end of the workout session. Hope this helps! :)

Upvotes: 2

Related Questions