gpt4 book ai didi

ios - 我无法让 HealthKit 工作。缺少权利

转载 作者:可可西里 更新时间:2023-11-01 03:29:04 26 4
gpt4 key购买 nike

我很难让 HealthKit 为我的 iOS 应用程序工作。我已经完成了所有步骤 I have found so far似乎没有一个能解决我的问题我在尝试授权 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 中启用了它,是的,我已经在我的开发中心 App ID 中启用了它。还有什么我可能会遗漏的吗?

最佳答案

我在使用 watchOS 2 应用程序时遇到了这个问题。解决方案是确保我为iOS 应用 watch 扩展程序启用了HealthKit 权利。

我错误地认为 iOS 应用程序的开关将由 watch 扩展程序继承。

关于ios - 我无法让 HealthKit 工作。缺少权利,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27162123/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com