HealthKit Permission Sheet Not Appearing
With this TestHealthKit, I was able to open the health-kit permission sheet.
// 4. Request HealthKit authorization (HealthStore as! HKHealthStore).requestAuthorizationToShareTypes(nil, readTypes: dataTypesToRead()) { (success, error) -> Void in // self.CheckAuthorizationStatusFor(self.dataTypesToRead()) if (success) { SuccessCompletion(success: success) return; } else { FailureCompletion(err: error) return; } }
As stated in the documentation, you must add the necessary keys to .plist if your app uses APIs that read or update user health data.
NSHealthShareUsageDescription
- A message to the user that explains why the app requested permission to read samples from the HealthKit store.
NSHealthUpdateUsageDescription
- A message to the user that explains why the app requested permission to save samples to the HealthKit store.