gpt4 book ai didi

requestAuthorizationToShareTypes 方法在 iOS 8 Xcode 6 中不显示权限提示

转载 作者:行者123 更新时间:2023-12-02 15:45:47 25 4
gpt4 key购买 nike

-(void)viewDidAppear:(BOOL)animated
{

[super viewDidAppear:animated];
if ([HKHealthStore isHealthDataAvailable]){
NSSet *writeDataTypes = [self dataTypesToWrite];
NSSet *readDataTypes = [self dataTypesToRead];

[self.healthStore requestAuthorizationToShareTypes:writeDataTypes readTypes:readDataTypes completion:^(BOOL success, NSError *error) {

NSLog(@"%s",__func__);
if (!success) {
NSLog(@"You didn't allow HealthKit to access these read/write data types. In your app, try to handle this error gracefully when a user decides not to provide access. The error was: %@. If you're using a simulator, try it on a device.", error);
return;
}

dispatch_async(dispatch_get_main_queue(), ^{
// Update the user interface based on the current user's health information.
NSLog(@"=========================== %s",__func__);
});
}];
}


}

requestAuthorizationToShareTypes 不会回调完成方法。

最佳答案

我也遇到了类似的问题,权限框没有出现,并且没有正确设置 HKHealthStore,所以提前为我解决了这个问题

self.healthStore = [[HKHealthStore alloc] init];

关于requestAuthorizationToShareTypes 方法在 iOS 8 Xcode 6 中不显示权限提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26010554/

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