我很难让 HealthKit 为我的 iOS 应用程序工作。我已经完成了所有步骤到目前为止我已经找到了 http://jademind.com/blog/posts/healthkit-api-tutorial/似乎没有一个能解决我的问题,当我尝试授权 Healthkit 时,我不断收到此错误:
Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x78fa24e0 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
这是我请求授权的代码:
if([HKHealthStore isHealthDataAvailable]) {
self.healthStore = [[HKHealthStore alloc] init];
[self.healthStore requestAuthorizationToShareTypes:nil readTypes:[self dataTypesToRead] completion:^(BOOL success, NSError *error) {
if (!success) {
NSLog(@"HK Error: %@", error);
[self presentHealthAlert:@"You didn't allow APP to access HealthKit Data. Please go to Settings and set up APP permissions." withTitle:@"Error"];
} else {
[self presentHealthAlert:@"Thank You For Access" withTitle:@"Success"];
}
}];
} else {
[self presentHealthAlert:@"Health Data Not Available" withTitle:@"Success"];
}
是的,我已经在我的项目功能中启用了它,是的,我已经在我的开发中心应用程序 ID 中启用了它。还有什么我可能想念的吗?
我在使用 watchOS 2 应用程序时遇到了这个问题。该解决方案是确保我已启用 HealthKit 权利bothiOS 应用程序and手表扩展。
我错误地认为 iOS 应用程序的开关将由手表扩展继承。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)