HKWorkoutSession does not support application before Apple Watch

It was stated that an application working with HKWorkoutSession will have special privileges compared to other watchOS 2 applications, so when a user looks at their Apple Watch, he will switch to a view showing the completion of the workout, and not the face of the time zone.

Currently, both on my device and on the simulator, this is not the case. If I start an HKWorkoutSession and then leave for 5 minutes and then interact with either Apple Watch or Watch Simulator, it represents the face of the watch.

If I open my application, it seems to have been frozen and not terminated (which, as I understand it, happens with other applications). Since the user interface will be updated when I need to get a response in my request.updateHandler. Also, if I set it to provide tactical feedback every time my .updateHandler request receives a new HKQuantitySample, it will do so, so the application should be running in the background in some form.

Has anyone else noticed this behavior and am I doing something wrong or expecting something that I should not do?

This is how I start my HKWorkoutSession:

self.workoutSession = HKWorkoutSession(activityType: HKWorkoutActivityType.Other, locationType: HKWorkoutSessionLocationType.Indoor) self.healthStore.startWorkoutSession(self.workoutSession) { success, error in if error != nil { print("startWorkoutSession \(error)\n") self.printLabel.setText("startWorkoutSession \(error)") self.printLabel.setTextColor(UIColor.redColor()) } 
+6
source share
1 answer

We also see this, at the moment we are sure that we are set to "open the last activity."

When the user interface is active, we run dispatch_timer to request and process data at intervals of 1 second.

Make sure you do some significant processing using the NSUserProcessInfo method and suspend dispatch_timers when you are no longer active. Otherwise, you will get crashes.

+2
source

All Articles