-
-
Save max6363/21187f8157e68ccc1e2b53cb6fcb8498 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Request to read data from health application. | |
*/ | |
- (void)requestToReadDataWithFinishBlock:(void (^)(NSError *error))finishBlock | |
{ | |
// read permission | |
NSArray *readTypes = @[ | |
[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierDistanceCycling] | |
]; | |
[self.healthStore requestAuthorizationToShareTypes:nil | |
readTypes:[NSSet setWithArray:readTypes] | |
completion:^(BOOL success, NSError * _Nullable error) { | |
dispatch_sync(dispatch_get_main_queue(), ^{ | |
if (error) { | |
finishBlock(error); | |
} else { | |
finishBlock(nil); | |
} | |
}); | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment