简体   繁体   English

我如何在iOS的Health Kit中编写Blood Type

[英]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). 我已经正确设置了HKHealthStore对象,并且现在尝试编写用户特征(即出生日期,生物性别,血液类型和Fitzpatrick皮肤类型)。 I can't find that type in HKQuantityTypeForIdentifier . 我在HKQuantityTypeForIdentifier找不到该类型。 How do I write blood type to HealthKit in Objective-C ? 如何在Objective-C中将血型写入HealthKit? 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 . 您可能必须将HKBloodTypeHKBloodType characteristicTypeForIdentifier:一起HKBloodType

https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HKObjectType_Class/index.html#//apple_ref/occ/clm/HKObjectType/characteristicTypeForIdentifier : 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 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. 没有用于修改用户特征的API。 The user must update the characteristics themselves in Health. 用户必须自己在“运行状况”中更新特征。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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