Trying to authorize on watchOS. Getting this error:
2019-03-20 18:32:45.859857-0600 iRun WatchKit Extension[21129:1854743] [default] containerAppExtensionEntitlementsWithCompletion: failed with error: (null)
My Capabilities for both my App and my Watch Extension are both turned on for HealthKit.
There is a similar question to mine on here but no one has answered it. Can't find any way to interpret this error??
My code to authorize:
if HKHealthStore.isHealthDataAvailable() {
let healthStore = HKHealthStore()
let heartRateQuantityType = HKObjectType.quantityType(forIdentifier: .heartRate)!
let allTypes = Set([HKObjectType.workoutType(),
heartRateQuantityType
])
healthStore.requestAuthorization(toShare: nil, read: allTypes) { (success, error) -> Void in
if success == false {
print("Error")
}
}
}
And for the AppDelegate.swift in my app:
func applicationShouldRequestHealthAuthorization(_ application: UIApplication) {
let healthStore = HKHealthStore()
healthStore.handleAuthorizationForExtension { (success, error) -> Void in
}
}