当锻炼跨越2个日历日时,HealthKit WorkoutSession失败

时间:2018-01-06 22:13:30

标签: ios swift apple-watch health-kit watch-os

我的Apple Watch应用会在.start开始HealthStore的对象上调用WorkoutSession。我发现如果用户开始锻炼,例如在第1天的晚上11:30,在第2天的上午12:30结束训练,他们无法进行.end锻炼,并且调用了委托方法func workoutSession(_ workoutSession: HKWorkoutSession, didFailWithError error: Error),并显示错误消息,即锻炼不是当前。

我做错了什么或这是一个错误? (我提交了radar)可能的工作?

  func start(_ workoutSession: HKWorkoutSession) {
        healthStore.start(workoutSession)
    }

    func end(_ workoutSession: HKWorkoutSession) {
        healthStore.end(workoutSession)
    }



 func workoutSession(_ workoutSession: HKWorkoutSession, didFailWithError error: Error) {
        showAlertWith(title: "WorkoutSession Failure", message: "tell Gary this: \(error) he'll fix it")
    }

0 个答案:

没有答案