ios - 在 iOS 的 Health Kit App 中显示月经详情

标签 ios objective-c healthkit

我有一个健康工具包对象,并进行了所有正确的设置;不过,我正在尝试检索健康包的月经数据。

但是,我无法在 HKQuantityTypeIdentifier 中找到相应的类型(即 HKCategoryValueMenstrualFlow)。

HKCategoryValueMenstrualFlow 包含一些子项,例如 HKCategoryValueMenstrualFlowLightHKCategoryValueMenstrualFlowMediumHKCategoryValueMenstrualFlowHeavy。使用以下方法,我编写的代码如下:

-(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) {
    }
}

我是这样写的。但我的疑问是如何在健康套件应用程序中显示月经数据的详细信息。请告诉我任何人给我提供任何想法。提前致谢。

最佳答案

可用的类型标识符常量在 HealthKit constants reference 中可用。 .您要查找的类型标识符是 HKCategoryTypeIdentifierMenstrualFlow

关于ios - 在 iOS 的 Health Kit App 中显示月经详情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36596731/

相关文章:

ios - 授权 HealthKit 时出错 - Code=100 "Rolling back the health database is unsupported."

ios - 只要计算正在运行,就禁用设备方向通知

ios - 仅当对象不存在时如何将对象添加到数组

ios - UIAlertController 关闭速度很慢

ios - hkworkout totalenergyburned 与 HKQuantityTypeIdentifierActiveEnergyBurned 不相关

ios - 如何使用 Swift 从 HealthKit for ios 应用程序获取循环持续时间

ios - 给变量赋值返回值

ios - 如何在 Cordova App 中打包 Watch App

ios - Swift 中的持续动画 View

objective-c - 了解 OOP 中的继承层次结构