I'm adding code for healthkit in my ios Swift app, but I'm getting an error...
/* Ask for permission to access the health store */
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
if HKHealthStore.isHealthDataAvailable(){
healthStore.requestAuthorizationToShareTypes(typesToShare,
readTypes: typesToRead,
completion: {(succeeded: Bool, error: NSError!) in
if succeeded && error == nil{
println("Successfully received authorization")
} else {
if let theError = error{
println("Error occurred = \(theError)")
}
}
})
} else {
println("Health data is not available")
}
}
Error occurred = Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x7fa748534b00 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
How can solve this?
Thanks!
I spent 3 days trying to figure out what was the problem. I found the solution with those steps:
I am using iOS 9.3.2 and Xcode 7.3.1