OGeek|极客世界-中国程序员成长平台

标题: ios - 错误域=com.apple.healthkit 代码=5 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:20
标题: ios - 错误域=com.apple.healthkit 代码=5

HKSampleType *stepType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount];

当我想要这些步骤时,它可以工作; 我想要 DistanceWalkingRunningExerciseTime,xcode 显示下一条消息。

Error Domain=com.apple.healthkit Code=5 “Authorization not determined 
UserInfo={NSLocalizedDescription=Authorization not determined}”

HKSampleType *walkingType = [HKQuantityType quantityTypeForIdentifier: 
HKQuantityTypeIdentifierAppleExerciseTime];

请有人帮助我。 谢谢。



Best Answer-推荐答案


HKObjectType *stepType = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierDistanceWalkingRunning];
NSSet *healthSet = [NSSet setWithObjects:stepType,nil];

太尴尬了!只需获得步数的授权,无需距离。

关于ios - 错误域=com.apple.healthkit 代码=5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45235317/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4