我在这里得到的这个错误到底是什么? (iOS, Xcode, Healthkit)

What is exactly this error I'm getting here? (iOS, Xcode, Healthkit)

func reuqestConnection(){
    var permReq: Set? = [HKObjectType.quantityType(forIdentifier: .heartRateVariabilitySDNN),
                        HKObjectType.quantityType(forIdentifier: .restingHeartRate),
                        HKObjectType.quantityType(forIdentifier: .heartRate)]
    if let healthStore = healthStore{
        healthStore.requestAuthorization(toShare: nil, read: permReq){ (success, error) in
            if(!success){
                //redirect to error view to try again.
            }
        }
    }
}//func ends

这就是代码,除了定义 HKHealthStore 的 init 函数之外,没有别的。我得到的错误是在为

请求授权时
Cannot convert value of type 'Set<HKQuantityType?>?' to expected argument type 'Set<HKObjectType>?'

我不确定这意味着什么,因为我以前没有收到此错误。我应该在这里做什么?

试试这个。 目前,我对 HKObjectType.quantityType 使用了强制解包。你需要处理这个。

func reuqestConnection(){
    var permReq: Set = [HKObjectType.quantityType(forIdentifier: .heartRateVariabilitySDNN)!,
                        HKObjectType.quantityType(forIdentifier: .restingHeartRate)!,
                        HKObjectType.quantityType(forIdentifier: .heartRate)!]
    if let healthStore = healthStore{
        healthStore.requestAuthorization(toShare: nil, read: permReq ){ (success, error) in
            if(!success){
                //redirect to error view to try again.
            }
        }
    }
}