Xcode 7.3とSwift 2. *で次の関数が動作していました:Xcode 8とSwift 3.0に移行した後、次のエラーが発生しました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