Авторизация для совместного использования следующих типов запрещена: HKCharacteristicTypeIdentifierDateOfBirth, HKCharacteristicTypeIdentifierBiologicalSex в версии swift ios 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
}