Last active
August 29, 2015 14:04
-
-
Save scottmkroberts/4054e0098570d980943b to your computer and use it in GitHub Desktop.
checkAuthorisationForCharacteristicType
This file contains hidden or 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
-(BOOL)checkAuthorisationForCharacteristicType:(HKCharacteristicType *)characteristicType{ | |
HKAuthorizationStatus authStatus = [self.store authorizationStatusForType:characteristicType]; | |
if(authStatus == HKAuthorizationStatusSharingAuthorized){ | |
return YES; | |
}else{ | |
return NO; | |
} | |
} | |
//Check auth is avilable for HKCharacteristicType | |
HKCharacteristicType *dateOfBirthType = [HKCharacteristicType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierDateOfBirth]; | |
if([self checkAuthorisationForCharacteristicType:dateOfBirthType]){ | |
NSDate *dateOfBirth = [self.store dateOfBirthWithError:&error]; | |
NSLog(@"Users date of birth = %@", dateOfBirth); | |
}else{ | |
NSLog(@"Users date of birth not accessible"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment