2016-04-12 26 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