Xcode 8 및 Swift 3.0으로 마이그레이션 한 후 Xcode 7.3 및 Swift 2 *에서 다음 기능이 작동했습니다. 컴파일 할 때 다음 오류가 발생했습니다.Xcode 8 및 Swift 3.0으로 마이그레이션 할 때 Xcode Healthkit 인증 기능 오류가 발생했습니다.
cannot call value of non-function type
((Bool, _ error:NSError?) -> Void)!
func authorizeHealthKit(_ completion: ((_ success:Bool, _ error:NSError?) -> Void)!) {
healthKitStore = HKHealthStore()
let typesSet:Set<HKSampleType> = [
HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.bodyTemperature)!,
HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.respiratoryRate)!,
HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.bloodPressureSystolic)!,
HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.bloodPressureDiastolic)!,
HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.bodyMass)!,
HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.heartRate)!,
HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.oxygenSaturation)!]
healthKitStore?.requestAuthorization(toShare: typesSet, read: typesSet, completion: { (boolVal, error) in
completion(success: boolVal, error: error) //<-- compile error here
})
}
[Markdown 또는 HTML을 사용하여 게시물의 서식을 지정하는 방법은 무엇입니까?] (http://stackoverflow.com/help/formatting) – buhtz