gpt4 book ai didi

ios - 不允许共享以下类型的授权 : HKCharacteristicTypeIdentifierDateOfBirth in swift ios 8. 4

转载 作者:可可西里 更新时间:2023-11-01 00:52:36 24 4
gpt4 key购买 nike

不允许共享以下类型的授权:HKCharacteristicTypeIdentifierDateOfBirth,HKCharacteristicTypeIdentifierBiologicalSex in swift ios version 8.4

healthKitStore.requestAuthorizationToShareTypes(healthKitTypesToRead, readTypes: healthKitTypesToWrite, completion: { (success, error) -> Void in

if( completion != nil )
{
completion(success:success,error:error)
}

})

返回 Fit 希望写入 HealthKit 的数据类型。

    func dataTypesToWrite() -> NSSet {

var dietaryCalorieEnergyType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDietaryEnergyConsumed) as HKQuantityType
var activeEnergyBurnType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned) as HKQuantityType
var heightType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierHeight) as HKQuantityType
var weightType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierBodyMass) as HKQuantityType

var set = Set([dietaryCalorieEnergyType, activeEnergyBurnType, heightType, weightType])

return set//[NSSet setWithObjects:dietaryCalorieEnergyType, activeEnergyBurnType, heightType, weightType, nil];
}

返回 Fit 希望从 HealthKit 读取的数据类型。

    func dataTypesToRead()->NSSet {
var dietaryCalorieEnergyType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDietaryEnergyConsumed) as HKQuantityType
var activeEnergyBurnType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned) as HKQuantityType
var heightType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierHeight) as HKQuantityType
var weightType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierBodyMass) as HKQuantityType
var birthdayType = HKObjectType.characteristicTypeForIdentifier(HKCharacteristicTypeIdentifierDateOfBirth) as HKCharacteristicType
var biologicalSexType = HKObjectType.characteristicTypeForIdentifier(HKCharacteristicTypeIdentifierBiologicalSex) as HKCharacteristicType

var set = Set([dietaryCalorieEnergyType, activeEnergyBurnType, heightType, weightType, birthdayType, biologicalSexType])

return set
}

最佳答案

requestAuthorizationToShareTypes 的参数是相反的。试试这个:

healthKitStore.requestAuthorizationToShareTypes(healthKitTypesToWrite, readTypes: healthKitTypesToRead, completion: { (success, error) -> Void in

if( completion != nil )
{
completion(success:success,error:error)
}
})

关于ios - 不允许共享以下类型的授权 : HKCharacteristicTypeIdentifierDateOfBirth in swift ios 8. 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31961962/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com