Post not yet marked as solved
Post marked as unsolved with 0 replies, 133 views
Hello, im having trouble making my code work and i keep running into the following error, i dont know how to fix my problem:
Cannot convert value of type 'Set<HKQuantityType?>' to expected argument type 'Set<HKObjectType>'
func healthPermission(){
if #available(iOS 15.0, *) {
let healthKitRead : Set<HKObjectType> = [
HKObjectType.quantityType(forIdentifier: .walkingAsymmetryPercentage)!,
HKObjectType.quantityType(forIdentifier: .appleWalkingSteadiness)!,
]
if !HKHealthStore.isHealthDataAvailable() {
print("permission fail")
return
}
healthStore.requestAuthorization(toShare: [], read: healthKitRead)
{ (success, error) -> Void in
print("Permission sucess")
}
} else {
// Fallback on earlier versions
}
}
Thanks for any help or advice.