I can't get HealthKit to work. Missing Entitlement
healthkit, ios, xcode6
Solution
I had this problem with a watchOS 2 app. The resolution was to ensure I had enabled the HealthKit entitlement for both the iOS app and the watch extension.
I had wrongly assumed the switch for the iOS app would be inherited by the watch extension.
Problem
I am having a hard time to get HealthKit working for my iOS App. I have done all the steps I have found so far and none seem to solve my problem I keep getting this error when trying to authorize Healthkit: ``` Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x78fa24e0 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.} ``` Here is my code asking for authorization: ``` if([HKHealthStore isHealthDataAvailable]) { self.healthStore = [[HKHealthStore alloc] init]; [self.healthStore requestAuthorizationToShareTypes:nil readTypes:[self dataTypesToRead] completion:^(BOOL success, NSError *error) { if (!success) { NSLog(@"HK Error: %@", error); [self presentHealthAlert:@"You didn't allow APP to access HealthKit Data. Please go to Settings and set up APP permissions." withTitle:@"Error"]; } else { [self presentHealthAlert:@"Thank You For Access" withTitle:@"Success"]; } }]; } else { [self presentHealthAlert:@"Health Data Not Available" withTitle:@"Success"]; } ``` And Yes, I have enabled it on my project Capabilites, and yes I have enabled it in my Dev Center App ID. Is there anything else I might be missing?