I am trying to read steps from Apple Health application but unable to find that user allows permission or denied. Here is my code:-
NSArray *readTypes = @[[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount]];
HKAuthorizationStatus permissionStatus = [self.healthStore authorizationStatusForType:[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount]];
if (permissionStatus == HKAuthorizationStatusSharingAuthorized) {
return ;
}
else{
[self.healthStore requestAuthorizationToShareTypes:[NSSet setWithArray:@[]] readTypes:[NSSet setWithArray:readTypes] completion:^(BOOL success, NSError * _Nullable error) {
NSLog(@"%@",error);
[[NSNotificationCenter defaultCenter] postNotificationName:kConnectToAppleHealthNotification object:nil];
}];
}
Now it shows screen to ask permission to read steps.but when I am trying to check permission status. it shows permission denied. How I can check permission is allow or denied.