我试图通过代码来请求授权的范畴中healthkit:参数类型“[HKCategoryType?]”不符合预期型“哈希的”
let healthKitStore: HKHealthStore = HKHealthStore()
let healthKitTypesToWrite = Set(arrayLiteral:[
HKObjectType.categoryType(forIdentifier: HKCategoryTypeIdentifierMindfulSession)
])
healthKitStore.requestAuthorizationToShareTypes(healthKitTypesToWrite, readTypes: healthKitTypesToRead) { (success, error) -> Void in
if(completion != nil)
{
completion(success:success,error:error)
}
}
从https://www.raywenderlich.com/86336/ios-8-healthkit-swift-getting-started。
然而,当我这样做,我得到:
参数类型“[?HKCategoryType]”不符合预期型 “哈希的”
如何保存在Healthkit类别通常有一个专用于HKCategoryType的教程,也可能有HKCategoryTypeIdentifierMindfulSession?