Displaying Menstruation Details in Health Kit App in iOS

送分小仙女□ 提交于 2019-12-06 15:24:50

问题


I have a health kit object with all the proper setup; however, I am trying to retrieve the menstruation data of health kit.

However, I cannot be able to find out the corresponding type in HKQuantityTypeIdentifier (i.e. HKCategoryValueMenstrualFlow).

The HKCategoryValueMenstrualFlow is having some of the sub items such as HKCategoryValueMenstrualFlowLight, HKCategoryValueMenstrualFlowMedium, HKCategoryValueMenstrualFlowHeavy. Using the following method, I am writing my code like this:

-(void)viewDidLoad {

    HKHealthStore *healthStore = [[HKHealthStore alloc] init];

    HKCategoryType *q=[NSSet setWithObjects:
    [HKCategoryType categoryTypeForIdentifier:HKCategoryValueMenstrualFlowHeavy],

    [HKCategoryType categoryTypeForIdentifier:HKCategoryValueMenstrualFlowMedium],

    [HKCategoryType categoryTypeForIdentifier:HKCategoryValueMenstrualFlowLight],

    [HKCategoryType categoryTypeForIdentifier:HKCategoryValueMenstrualFlowUnspecified],nil];

    [healthStore requestAuthorizationToShareTypes:shareObjectTypes readTypes: healthStore completion:^(BOOL success, NSError *error) {

    if(success == YES) {
    }
}

I am writing like this. But my doubt is how to show the details in menstruation data in the health kit app. Please tell me anybody by providing me with any idea. Thanks in advance.


回答1:


The available type identifier constants are available in the HealthKit constants reference. The type identifier you are looking for is HKCategoryTypeIdentifierMenstrualFlow.



来源:https://stackoverflow.com/questions/36596731/displaying-menstruation-details-in-health-kit-app-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!