Last active
May 8, 2018 18:51
-
-
Save max6363/09533154aea5a41c94b66ad7b88d1f70 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
- (void)requestToWriteDataWithFinishBlock:(void (^)(NSError *error))finishBlock | |
{ | |
// write permission | |
NSArray *writeTypes = @[ | |
[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount] | |
]; | |
[self.healthStore requestAuthorizationToShareTypes:[NSSet setWithArray:writeTypes] | |
readTypes:nil | |
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