我很难让 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.}
这是我要求授权的代码:
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"];
}
是的,我已经在我的项目 Capabilites 中启用了它,是的,我已经在我的 Dev Center App ID 中启用了它。还有什么我可能会丢失的吗?