我很难让HealthKit为我的iOS应用程序工作.我已经完成了迄今为止我找到的所有步骤,似乎没有解决我的问题我在尝试授权Healthkit时遇到此错误:
Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x78fa24e0 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
Run Code Online (Sandbox Code Playgroud)
这是我的代码要求授权:
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"];
}
Run Code Online (Sandbox Code Playgroud)
是的,我在我的项目Capabilites上启用了它,是的,我已经在我的开发中心应用程序ID中启用了它.还有什么我可能会失踪的吗?