2016-04-12 25 views
-1

我有一个HKHealthStore对象正确设置,现在我正在尝试编写用户特征(即出生日期,生物性别,血型和Fitzpatrick皮肤类型)。 HKQuantityTypeForIdentifier我找不到那种类型。如何在Objective-C的HealthKit中写血型?我尝试以下操作:如何在iOS中写入健康工具包中的血型

int Dateofbirth=20-10-1995; 

NSLog(@“%d”, Dateofbirth); 

sex=gender; 

BloodType= A+ve; 

Fitzpatrick Skin Type= something; 

HKQuantityType* bodytemp = [HKQuantityType quantityTypeForIdentifier: HKQuantityTypeIdentifier]; 
+0

请帮助我的任何机构.. – satya

+0

@JAGAT你会plz帮助我......? – satya

+1

你的代码甚至不接近实际的代码。你需要学习如何在你自己的工作 –

回答

2

您可能需要使用characteristicTypeForIdentifier:HKBloodType

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

常量从血型:

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

+0

感谢您的回应..如何修改我的代码?你会指导我 – satya

+0

你会帮我plz如何做到这一点? – satya

2

没有API来修改用户的特性。用户必须在Health中自行更新特征。

+0

感谢您的回复。但我不明白你说的是..你的意思是用户可以手动输入设备或某些东西? plz告诉我这是我的首要任务 – satya

+0

Launch Health,进入健康数据选项卡,点击我,点击右上角的编辑按钮,然后点击血型来设置您的HealthKit血型。 – Allan

+0

感谢您的回复..我的问题解决了我面临一些其他问题.. PLZ检查链接..“http://stackoverflow.com/questions/36596731/displaying-menstruation-details-in-health-kit-app如果你有任何想法,请告诉我 – satya