欢迎光临
我们一直在努力

从iPhone获取或写入HealthKit属性,我可以帮到你。

建站超值云服务器,限时71元/月

从iPhone获取或写入HealthKit属性,我可以帮到你。

项目介绍:

skoal

GitHub

  skoal,一款基于HealthKit获取iPhone健康有关的属性库,支持读写.

HealthStore 对应支持属性

Sample HealthKit Identifier Type Read Write
StepCount HKQuantityTypeIdentifierStepCount
Height HKQuantityTypeIdentifierHeight
BodyMass HKQuantityTypeIdentifierBodyMass
BodyMassIndex HKQuantityTypeIdentifierBodyMassIndex
DistanceWalkingRunning HKQuantityTypeIdentifierDistanceWalkingRunning
FlightsClimbed HKQuantityTypeIdentifierFlightsClimbed
RespiratoryRate HKQuantityTypeIdentifierRespiratoryRate
DietaryEnergyConsumed HKQuantityTypeIdentifierDietaryEnergyConsumed
OxygenSaturation HKQuantityTypeIdentifierOxygenSaturation
BodyTemperature HKQuantityTypeIdentifierBodyTemperature
BloodGlucose HKQuantityTypeIdentifierBloodGlucose
BloodPressureSystolic HKQuantityTypeIdentifierBloodPressureSystolic
BloodPressureDiastolic HKQuantityTypeIdentifierBloodPressureDiastolic
StandHour HKCategoryTypeIdentifierAppleStandHour
BiologicalSex biologicalSexWithError
DateOfBirth dateOfBirthComponentsWithError
BloodType bloodTypeWithError
FitzpatrickSkin fitzpatrickSkinTypeWithError
SleepAnalysis HKCategoryTypeIdentifierSleepAnalysis
MenstrualFlow HKCategoryTypeIdentifierMenstrualFlow
IntermenstrualBleeding HKCategoryTypeIdentifierIntermenstrualBleeding
SexualActivity HKCategoryTypeIdentifierSexualActivity

License

skoaluse MIT license

Installation with cocoapods

 pod 'skoal'

Usage

  • You should get HealthKit privacy permission before you use ‘skoal’

  • See the function by preview below

  • Start the project to see the example

  • Objective-C

      [[skoal sharedInstance]requestHealthPermissionWithBlock:^(HealthStorePermissionResponse permissionResponse) {
            if (permissionResponse == HealthStorePermissionResponseError) {
                DLog(@"请求权限失败");
            }else{
                DLog(@"请求权限成功");
            }
        }];
  • Swift

             skoal.sharedInstance().requestHealthPermission { (response: HealthStorePermissionResponse) in
                 if response == HealthStorePermissionResponse.error {
                     print("请求失败")
                 } else {
                     print("请求成功")
                }
            }
方法预览 方法预览
方法预览 方法预览]
赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 从iPhone获取或写入HealthKit属性,我可以帮到你。
分享到: 更多 (0)