Created
July 12, 2017 18:55
-
-
Save mattrobmattrob/5c45b869738ecd352c40f02439a7d184 to your computer and use it in GitHub Desktop.
Strava Apple Watch Blog - HealthKit
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
/// After using `requestAuthorizationToShareTypes:readTypes:completion:` | |
- (BOOL)hasRequestedHeartRateAuthorization | |
{ | |
return (HKAuthorizationStatusNotDetermined != [HKHealthStore authorizationStatusForType:[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeartRate]]); | |
} | |
- (void)requestHeartRateAuthorizationWithCompletion:(void (^)(BOOL succes, NSError *error))completion | |
{ | |
NSSet *readTypes = [NSSet setWithObject:[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeartRate]]; | |
[self.store requestAuthorizationToShareTypes:nil readTypes:readTypes completion:^(BOOL success, NSError *error){ | |
completion(success, error); | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment