简体   繁体   中英

How do i write Blood Type in Health kit in iOS

I have a HKHealthStore object properly set up, and I am now trying to write user characteristics (ie Date of Birth, Biological Sex, Blood Type and Fitzpatrick Skin Type). I can't find that type in HKQuantityTypeForIdentifier . How do I write blood type to HealthKit in Objective-C ? I am trying the following:

int Dateofbirth=20-10-1995;

NSLog(@“%d”, Dateofbirth);

sex=gender;

BloodType= A+ve;

Fitzpatrick Skin Type= something;

HKQuantityType* bodytemp = [HKQuantityType quantityTypeForIdentifier: HKQuantityTypeIdentifier];

You may have to use characteristicTypeForIdentifier: with HKBloodType .

https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HKObjectType_Class/index.html#//apple_ref/occ/clm/HKObjectType/characteristicTypeForIdentifier :

Constants from Blood type:

typedef enum : NSInteger {
   HKBloodTypeNotSet = 0,
   HKBloodTypeAPositive,
   HKBloodTypeANegative,
   HKBloodTypeBPositive,
   HKBloodTypeBNegative,
   HKBloodTypeABPositive,
   HKBloodTypeABNegative,
   HKBloodTypeOPositive,
   HKBloodTypeONegative,
} HKBloodType;

https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HealthKit_Constants/index.html#//apple_ref/c/tdef/HKBloodType

There is no API to modify user characteristics. The user must update the characteristics themselves in Health.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM