-
Notifications
You must be signed in to change notification settings - Fork 0
/
HealthKit.framework.h
5857 lines (4885 loc) · 267 KB
/
HealthKit.framework.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ========== HealthKit.framework/Headers/HKQuantity.h
//
// HKQuantity.h
// HealthKit
//
// Copyright (c) 2013-2014 Apple Inc. All rights reserved.
//
#import <HealthKit/HKDefines.h>
NS_ASSUME_NONNULL_BEGIN
@class HKUnit;
/*!
@class HKQuantity
@abstract The HKQuantity class provides an encapsulation of a quantity value and the unit of measurement.
*/
HK_EXTERN API_AVAILABLE(ios(8.0), watchos(2.0))
@interface HKQuantity : NSObject <NSSecureCoding, NSCopying>
- (instancetype)init NS_UNAVAILABLE;
/*!
@method quantityWithUnit:doubleValue:
@abstract Returns a new object representing a quantity measurement with the given unit.
*/
+ (instancetype)quantityWithUnit:(HKUnit *)unit doubleValue:(double)value;
/*!
@method isCompatibleWithUnit:
@abstract Returns yes if the receiver's value can be converted to a value of the given unit.
*/
- (BOOL)isCompatibleWithUnit:(HKUnit *)unit;
/*!
@method doubleValueForUnit:
@abstract Returns the quantity value converted to the given unit.
@discussion Throws an exception if the receiver's value cannot be converted to one of the requested unit.
*/
- (double)doubleValueForUnit:(HKUnit *)unit;
/*!
@method compare:
@abstract Returns an NSComparisonResult value that indicates whether the receiver is greater than, equal to, or
less than a given quantity.
@discussion Throws an exception if the unit of the given quantity is not compatible with the receiver's unit.
*/
- (NSComparisonResult)compare:(HKQuantity *)quantity;
@end
NS_ASSUME_NONNULL_END
// ========== HealthKit.framework/Headers/HKMetadata.h
//
// HKMetadata.h
// HealthKit
//
// Copyright (c) 2013-2018 Apple Inc. All rights reserved.
//
#import <HealthKit/HKDefines.h>
NS_ASSUME_NONNULL_BEGIN
/*!
@constant HKMetadataKeyUDIProductionIdentifier
@abstract Represents the serial number of the device that created the HKObject.
@discussion The expected value type is NSString.
*/
HK_EXTERN NSString * const HKMetadataKeyDeviceSerialNumber API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyBodyTemperatureSensorLocation
@abstract Represents the location where a particular body temperature reading was taken.
@discussion The expected value type is an NSNumber containing a HKBodyTemperatureSensorLocation value.
*/
HK_EXTERN NSString * const HKMetadataKeyBodyTemperatureSensorLocation API_AVAILABLE(ios(8.0), watchos(2.0));
typedef NS_ENUM(NSInteger, HKBodyTemperatureSensorLocation) {
HKBodyTemperatureSensorLocationOther = 0,
HKBodyTemperatureSensorLocationArmpit,
HKBodyTemperatureSensorLocationBody,
HKBodyTemperatureSensorLocationEar,
HKBodyTemperatureSensorLocationFinger,
HKBodyTemperatureSensorLocationGastroIntestinal,
HKBodyTemperatureSensorLocationMouth,
HKBodyTemperatureSensorLocationRectum,
HKBodyTemperatureSensorLocationToe,
HKBodyTemperatureSensorLocationEarDrum,
HKBodyTemperatureSensorLocationTemporalArtery,
HKBodyTemperatureSensorLocationForehead,
} API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyHeartRateSensorLocation
@abstract Represents the location where a particular heart rate reading was taken.
@discussion The expected value type is an NSNumber containing a HKHeartRateSensorLocation value.
*/
HK_EXTERN NSString * const HKMetadataKeyHeartRateSensorLocation API_AVAILABLE(ios(8.0), watchos(2.0));
typedef NS_ENUM(NSInteger, HKHeartRateSensorLocation) {
HKHeartRateSensorLocationOther = 0,
HKHeartRateSensorLocationChest,
HKHeartRateSensorLocationWrist,
HKHeartRateSensorLocationFinger,
HKHeartRateSensorLocationHand,
HKHeartRateSensorLocationEarLobe,
HKHeartRateSensorLocationFoot,
} API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyHeartRateMotionContext
@abstract Represents the context in which a particular heart rate reading was taken.
@discussion The expected value type is an NSNumber containing a HKHeartRateMotionContext value. The value is active
(HKHeartRateMotionContextActive) if the user is in motion or working out, sedentary if the user is
still (HKHeartRateMotionContextSedentary), or not set (HKHeartRateMotionContextNotSet) otherwise.
*/
HK_EXTERN NSString * const HKMetadataKeyHeartRateMotionContext API_AVAILABLE(ios(11.0), watchos(4.0));
typedef NS_ENUM(NSInteger, HKHeartRateMotionContext) {
HKHeartRateMotionContextNotSet = 0,
HKHeartRateMotionContextSedentary,
HKHeartRateMotionContextActive,
} API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@constant HKMetadataKeyFoodType
@abstract Represents the type of food that was consumed when creating an HKObject.
@discussion This should be a short string representing the type of food, such as 'Banana'. The expected value type
is NSString.
*/
HK_EXTERN NSString * const HKMetadataKeyFoodType API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyUDIDeviceIdentifier
@abstract Represents the device identifier portion of a device's UDI (Unique Device Identifier).
@discussion The device identifier can be used to reference the GUDID (Globally Unique Device Identifier Database).
The expected value type is NSString.
** Note that the use of this key is now discouraged in favor of the HKDevice class.
*/
HK_EXTERN NSString * const HKMetadataKeyUDIDeviceIdentifier API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyUDIProductionIdentifier
@abstract Represents the production identifier portion of a device's UDI (Unique Device Identifier).
@discussion While part of a device's UDI, the production identifier is not saved in the FDA's GUDID
(Globally Unique Device Identifier Database) and its use in HealthKit is now discouraged for
user privacy reasons. Apps should consider handling this independently of HealthKit APIs if
needed.
The expected value type is NSString.
*/
HK_EXTERN NSString * const HKMetadataKeyUDIProductionIdentifier API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyDigitalSignature
@abstract Represents a digital signature validating the origin of an HKObject's value.
@discussion Intended to provide data integrity for sample data produced by trusted (tamper resistant) measuring devices.
The digital signature format should be CMS (Cryptographic Message Syntax specified in IETF RFC 5652).
It should be a “Signed-data” type signature containing the data items to be signed (e.g., timestamp, value, etc.)
using ASN.1 encoding with DER (Distinguished Encoding Rules). The entire enveloping signature should be further
encoded using base64. Recommended digest is SHA256, and recommended cipher is FIPS PUB 186-4 Digital Signature
Standard Elliptic Curve P-256. See documentation for details.
*/
HK_EXTERN NSString * const HKMetadataKeyDigitalSignature API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyExternalUUID
@abstract Represents a unique identifier for an HKObject that is set by its source.
Uniqueness of objects with the same value of this key is not enforced by HealthKit.
@discussion The expected value type is NSString.
*/
HK_EXTERN NSString * const HKMetadataKeyExternalUUID API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeySyncIdentifier
@abstract Represents an identifier for an HKObject that is set by its source and is used by HealthKit to uniquely
identify an object.
@discussion Saving a HKObject with a HKMetadataKeySyncIdentifier will replace an existing HKObject with the
same HKMetadataKeySyncIdentifier value if the new HKObject has a greater HKMetadataKeySyncVersion.
The new sample will be added to all HKWorkouts or HKCorrelations containing the replaced sample.
HKMetadataKeySyncVersion must be provided if HKMetadataKeySyncIdentifier is provided.
The expected value type is NSString.
*/
HK_EXTERN NSString * const HKMetadataKeySyncIdentifier API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@constant HKMetadataKeySyncVersion
@abstract Represents the version of the HKObject that is set by its source and is used by HealthKit to identify an
object's version.
@discussion HKMetadataKeySyncVersion may not be provided if HKMetadataKeySyncIdentifier is not provided.
The expected value type is NSNumber.
*/
HK_EXTERN NSString * const HKMetadataKeySyncVersion API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@constant HKMetadataKeyTimeZone
@abstract Represents the time zone that the user was in when the HKObject was created.
@discussion The expected value type is an NSString compatible with NSTimeZone's +timeZoneWithName:.
*/
HK_EXTERN NSString * const HKMetadataKeyTimeZone API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyDeviceName
@abstract Represents the name of the device that took the reading.
@discussion The expected value type is NSString.
** Note that the use of this key is now discouraged in favor of the HKDevice class.
*/
HK_EXTERN NSString * const HKMetadataKeyDeviceName API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyDeviceManufacturerName
@abstract Represents the name of the manufacturer of the device that took the reading.
@discussion The expected value type is NSString.
** Note that the use of this key is now discouraged in favor of the HKDevice class.
*/
HK_EXTERN NSString * const HKMetadataKeyDeviceManufacturerName API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyWasTakenInLab
@abstract Represents whether or not the reading was taken in a lab.
@discussion The expected value type is an NSNumber containing a BOOL value.
*/
HK_EXTERN NSString * const HKMetadataKeyWasTakenInLab API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyReferenceRangeLowerLimit
@abstract Represents the lower limit of the reference range for a lab result.
@discussion The expected value type is an NSNumber.
*/
HK_EXTERN NSString * const HKMetadataKeyReferenceRangeLowerLimit API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyReferenceRangeUpperLimit
@abstract Represents the upper limit of the reference range for a lab result.
@discussion The expected value type is an NSNumber.
*/
HK_EXTERN NSString * const HKMetadataKeyReferenceRangeUpperLimit API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyWasUserEntered
@abstract Represents whether or not the reading was entered by the user.
@discussion The expected value type is an NSNumber containing a BOOL value.
*/
HK_EXTERN NSString * const HKMetadataKeyWasUserEntered API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyWorkoutBrandName
@abstract Represents the brand name of a particular workout.
@discussion The expected value type is NSString.
*/
HK_EXTERN NSString * const HKMetadataKeyWorkoutBrandName API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyGroupFitness
@abstract Represents whether or not a workout was performed as part of a group fitness class.
@discussion The expected value type is an NSNumber containing a BOOL value.
*/
HK_EXTERN NSString * const HKMetadataKeyGroupFitness API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyIndoorWorkout
@abstract Represents whether or not a workout was performed indoors as opposed to outdoors.
@discussion The expected value type is an NSNumber containing a BOOL value.
*/
HK_EXTERN NSString * const HKMetadataKeyIndoorWorkout API_AVAILABLE(ios(8.0), watchos(2.0));
/*!
@constant HKMetadataKeyCoachedWorkout
@abstract Represents whether or not a workout was performed with a coach or personal trainer.
@discussion The expected value type is an NSNumber containing a BOOL value.
*/
HK_EXTERN NSString * const HKMetadataKeyCoachedWorkout API_AVAILABLE(ios(8.0), watchos(2.0));
typedef NS_ENUM(NSInteger, HKWeatherCondition) {
HKWeatherConditionNone = 0,
HKWeatherConditionClear,
HKWeatherConditionFair,
HKWeatherConditionPartlyCloudy,
HKWeatherConditionMostlyCloudy,
HKWeatherConditionCloudy,
HKWeatherConditionFoggy,
HKWeatherConditionHaze,
HKWeatherConditionWindy,
HKWeatherConditionBlustery,
HKWeatherConditionSmoky,
HKWeatherConditionDust,
HKWeatherConditionSnow,
HKWeatherConditionHail,
HKWeatherConditionSleet,
HKWeatherConditionFreezingDrizzle,
HKWeatherConditionFreezingRain,
HKWeatherConditionMixedRainAndHail,
HKWeatherConditionMixedRainAndSnow,
HKWeatherConditionMixedRainAndSleet,
HKWeatherConditionMixedSnowAndSleet,
HKWeatherConditionDrizzle,
HKWeatherConditionScatteredShowers,
HKWeatherConditionShowers,
HKWeatherConditionThunderstorms,
HKWeatherConditionTropicalStorm,
HKWeatherConditionHurricane,
HKWeatherConditionTornado,
} API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@constant HKMetadataKeyWeatherCondition
@abstract Represents the weather condition during the sample.
@discussion The expected value type is an NSNumber containing an HKWeatherCondition value. This key may be set on an
HKWorkout object to represent the overall weather condition during the workout.
*/
HK_EXTERN NSString * const HKMetadataKeyWeatherCondition API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@constant HKMetadataKeyWeatherTemperature
@abstract Represents the weather temperature during the sample.
@discussion The expected value type is an HKQuantity expressed in a temperature unit. This key may be set on an
HKWorkout object to represent the overall temperature during the workout.
*/
HK_EXTERN NSString * const HKMetadataKeyWeatherTemperature API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@constant HKMetadataKeyHumidity
@abstract Represents the weather humidity during the sample.
@discussion The expected value type is an HKQuantity expressed in percent. This key may be set on an HKWorkout
object to represent the overall humidity during the workout.
*/
HK_EXTERN NSString * const HKMetadataKeyWeatherHumidity API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@constant HKMetadataKeySexualActivityProtectionUsed
@abstract Represents whether or not protection was used during sexual activity. This can be used to track either
protection from STIs or protection from pregnancy.
@discussion The expected value type is an NSNumber containing a BOOL value.
*/
HK_EXTERN NSString * const HKMetadataKeySexualActivityProtectionUsed API_AVAILABLE(ios(9.0), watchos(2.0));
/*!
@constant HKMetadataKeyMenstrualCycleStart
@abstract Indicates whether or not the sample represents the start of a menstrual cycle. This is a required
metadata key for category samples of type HKCategoryTypeIdentifierMenstrualFlow.
@discussion The expected value type is an NSNumber containing a BOOL value.
*/
HK_EXTERN NSString * const HKMetadataKeyMenstrualCycleStart API_AVAILABLE(ios(9.0), watchos(2.0));
/*!
@constant HKMetadataKeyLapLength
@abstract Represents the length of a lap recorded during a workout.
@discussion The expected value type is an HKQuantity object compatible with a length unit. This key may be set on an
HKWorkout object to represent the length of a lap.
*/
HK_EXTERN NSString * const HKMetadataKeyLapLength API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@enum HKWorkoutSwimmingLocationType
@abstract This enumerated type is used to represent the location type of a swimming workout.
@discussion This value indicates whether a swimming workout was performed in a pool or open water.
*/
typedef NS_ENUM(NSInteger, HKWorkoutSwimmingLocationType) {
HKWorkoutSwimmingLocationTypeUnknown = 0,
HKWorkoutSwimmingLocationTypePool,
HKWorkoutSwimmingLocationTypeOpenWater,
} API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@constant HKMetadataKeySwimmingLocationType
@abstract Represents the location type of a swimming workout.
@discussion The expected value type is an NSNumber containing an HKWorkoutSwimmingLocationType value. This key may
be set on an HKWorkout object to represent the swimming location type.
*/
HK_EXTERN NSString * const HKMetadataKeySwimmingLocationType API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@enum HKSwimmingStrokeStyle
@abstract Represents a style of stroke used during a swimming workout.
*/
typedef NS_ENUM(NSInteger, HKSwimmingStrokeStyle) {
HKSwimmingStrokeStyleUnknown = 0,
HKSwimmingStrokeStyleMixed,
HKSwimmingStrokeStyleFreestyle,
HKSwimmingStrokeStyleBackstroke,
HKSwimmingStrokeStyleBreaststroke,
HKSwimmingStrokeStyleButterfly,
} API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@constant HKMetadataKeySwimmingStrokeStyle
@abstract Represents the predominant stroke style during a lap of a swimming workout.
@discussion The expected value type is an NSNumber containing an HKSwimmingStrokeStyle value. This key may be set on
an HKWorkoutEvent object with the type HKWorkoutEventTypeLap to represent the predominant style used
during the lap.
*/
HK_EXTERN NSString * const HKMetadataKeySwimmingStrokeStyle API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@enum HKInsulinDeliveryReason
@abstract Represents a medical reason for the delivery of insulin
@constant HKInsulinDeliveryReasonBasal Delivery for the base metabolic needs of the individual, often
administered as a continuous rate from an insulin pump, or a periodic
injection of slow-acting insulin.
@constant HKInsulinDeliveryReasonBolus Delivery for the episodic needs of the individual, such as a meal or
glucose level correction.
*/
typedef NS_ENUM(NSInteger, HKInsulinDeliveryReason) {
HKInsulinDeliveryReasonBasal = 1,
HKInsulinDeliveryReasonBolus,
} API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@constant HKMetadataKeyInsulinDeliveryReason
@abstract Represents the medical reason for the delivery of an insulin dose. This is a required metadata key for
samples of type HKQuantityTypeIdentifierInsulinDelivery.
@discussion The expected value type is an NSNumber containing a HKInsulinDeliveryReason value.
*/
HK_EXTERN NSString * const HKMetadataKeyInsulinDeliveryReason API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@enum HKBloodGlucoseMealTime
@abstract Indicates how your blood glucose reading relates to a meal.
@constant HKBloodGlucoseMealTimePreprandial A glucose value measured at the time just before a meal.
@constant HKBloodGlucoseMealTimePostprandial A glucose value measured after a meal.
*/
typedef NS_ENUM(NSInteger, HKBloodGlucoseMealTime) {
HKBloodGlucoseMealTimePreprandial = 1,
HKBloodGlucoseMealTimePostprandial,
} API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@constant HKMetadataKeyBloodGlucoseMealTime
@abstract Indicates the relative timing of a blood glucose reading to a meal.
@discussion This timing, as well as other factors like meal composition, can be used by medical professionals to
determine the acceptable value range for a blood glucose reading. For use cases requiring the capture of
precise timing and composition information, developers should record additional dietary samples, such as
HKQuantityTypeIdentifierDietaryCarbohydrates. The expected value type is an NSNumber containing a
HKBloodGlucoseMealTime value.
*/
HK_EXTERN NSString * const HKMetadataKeyBloodGlucoseMealTime API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@enum HKVO2MaxTestType
@abstract Represents the test used to create a VO2 Max Sample.
@constant HKVO2MaxTestTypeMaxExercise A user is exerted to their physical limit to evaluate and
measure actual VO2Max.
@constant HKVO2MaxTestTypePredictionSubMaxExercise A specific test protocol is used to calculate and correlate a
predicted VO2Max.
@constant HKVO2MaxTestTypePredictionNonExercise A non-exercise equation is used based on user metrics to
calculate a predicted VO2Max.
*/
typedef NS_ENUM(NSInteger, HKVO2MaxTestType) {
HKVO2MaxTestTypeMaxExercise = 1,
HKVO2MaxTestTypePredictionSubMaxExercise,
HKVO2MaxTestTypePredictionNonExercise,
} API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@constant HKMetadataKeyVO2MaxTestType
@abstract Represents the test used to create VO2 Max Sample
@discussion The expected value type is an NSNumber containing a HKVO2MaxTestType value.
*/
HK_EXTERN NSString * const HKMetadataKeyVO2MaxTestType API_AVAILABLE(ios(11.0), watchos(4.0));
/*!
@constant HKMetadataKeyAverageSpeed
@abstract Represents the average speed for a workout segment or distance sample.
@discussion This represents the average speed when moving so it may not match the value of distance/time for a
distance sample.
The expected value type is an HKQuantity object compatible with a speed unit (e.g. m/s). This key may be
set on quantity samples of type HKQuantityTypeIdentifierDistanceDownhillSnowSports or a workout segment
representing a skiing run.
*/
HK_EXTERN NSString * const HKMetadataKeyAverageSpeed API_AVAILABLE(ios(11.2), watchos(4.2));
/*!
@constant HKMetadataKeyMaximumSpeed
@abstract Represents the maximum speed for a workout segment or distance sample.
@discussion The expected value type is an HKQuantity object compatible with a speed unit (e.g. m/s). This key may be
set on quantity samples of type HKQuantityTypeIdentifierDistanceDownhillSnowSports or a workout segment
representing a skiing run.
*/
HK_EXTERN NSString * const HKMetadataKeyMaximumSpeed API_AVAILABLE(ios(11.2), watchos(4.2));
/*!
@constant HKMetadataKeyAlpineSlopeGrade
@abstract Represents the grade of a ski run.
@discussion Alpine slope grade is measured in percent where 100% grade is a 45 degree slope.
The expected value type is an HKQuantity object compatible with percent unit. This key may be set on
quantity samples of type HKQuantityTypeIdentifierDistanceDownhillSnowSports or a workout segment
representing a skiing run.
*/
HK_EXTERN NSString * const HKMetadataKeyAlpineSlopeGrade API_AVAILABLE(ios(11.2), watchos(4.2));
/*!
@constant HKMetadataKeyElevationAscended
@abstract Represents the cumulative elevation ascent during a workout.
@discussion The expected value type is an HKQuantity object compatible with length unit. This key may be set on a
workout, workout segments or distance samples.
*/
HK_EXTERN NSString * const HKMetadataKeyElevationAscended API_AVAILABLE(ios(11.2), watchos(4.2));
/*!
@constant HKMetadataKeyElevationDescended
@abstract Represents the cumulative elevation descent during a workout.
@discussion The expected value type is an HKQuantity object compatible with length unit. This key may be set on a
workout, workout segments or distance samples.
*/
HK_EXTERN NSString * const HKMetadataKeyElevationDescended API_AVAILABLE(ios(11.2), watchos(4.2));
/*!
@constant HKMetadataKeyFitnessMachineDuration
@abstract Represents the workout duration as displayed by a GymKit connected fitness machine.
@discussion The expected value type is an HKQuantity object compatible with a time unit. This key may be set on an
HKWorkout object to represent the duration of the workout as displayed by a GymKit connected fitness
machine.
*/
HK_EXTERN NSString * const HKMetadataKeyFitnessMachineDuration API_AVAILABLE(ios(12.0), watchos(5.0));
/*!
@constant HKMetadataKeyIndoorBikeDistance
@abstract Represents the distance covered during an indoor bike workout.
@discussion The expected value type is an HKQuantity object compatible with a length unit. This key may be set on an
HKWorkout object to represent the distance covered during an indoor bike workout.
*/
HK_EXTERN NSString * const HKMetadataKeyIndoorBikeDistance API_AVAILABLE(ios(12.0), watchos(5.0));
/*!
@constant HKMetadataKeyCrossTrainerDistance
@abstract Represents the distance covered during a cross trainer workout.
@discussion The expected value type is an HKQuantity object compatible with a length unit. This key may be set on an
HKWorkout object to represent the distance covered during a cross trainer workout.
*/
HK_EXTERN NSString * const HKMetadataKeyCrossTrainerDistance API_AVAILABLE(ios(12.0), watchos(5.0));
/*!
@constant HKMetadataKeyHeartRateEventThreshold
@abstract Represents the threshold heart rate that triggered a heart rate event.
@discussion The expected value is an HKQuantity object with a compatible unit (e.g. count/min).
This key will be set on heart rate event samples of type HKCategoryTypeIdentifierHighHeartRateEvent and
HKCategoryTypeIdentifierLowHeartRateEvent.
*/
HK_EXTERN NSString * const HKMetadataKeyHeartRateEventThreshold API_AVAILABLE(ios(12.2), watchos(5.2));
/*!
@constant HKMetadataKeyAverageMETs
@abstract Represents the average METs, or Metabolic Equivalent of Task during a workout.
@discussion The expected value type is an HKQuantity expressed in a METs (kcal/(kg*hr)) unit. This key may be set on an
HKWorkout object to represent the average workout intensity represented as METs over the entire workout duration.
*/
HK_EXTERN NSString * const HKMetadataKeyAverageMETs API_AVAILABLE(ios(13.0), watchos(6.0));
/*!
@constant HKMetadataKeyAudioExposureLevel
@abstract Represents the audio level associated with an audio event.
@discussion The expected value is an HKQuantity whose value is the audio level
associated with the event measured in dbASPL units.
*/
HK_EXTERN NSString * const HKMetadataKeyAudioExposureLevel API_AVAILABLE(ios(13.0), watchos(6.0));
NS_ASSUME_NONNULL_END
// ========== HealthKit.framework/Headers/HKSeriesBuilder.h
//
// HKSeriesBuilder.h
// HealthKit
//
// Copyright (c) 2015 Apple. All rights reserved.
//
#import <HealthKit/HKDefines.h>
NS_ASSUME_NONNULL_BEGIN
/*!
@class HKSeriesBuilder
@abstract An HKSeriesBuilder is an abstract class for generating HKSeriesSample objects.
Concrete subclasses generate the actual HKSeriesSample objects.
*/
HK_EXTERN
@interface HKSeriesBuilder : NSObject
/*!
@method discard
@abstract Stop series generation and discard all collected data.
@discussion This method informs the receiver that no more data should be collected and all
previously collected data should be deleted and the receiver will be considered
invalid. Any further calls to the receiver will result in an exception.
*/
- (void)discard;
/*!
@method init
@abstract Use only subclass initializer methods.
*/
- (instancetype)init NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
// ========== HealthKit.framework/Headers/HealthKit.h
//
// HealthKit.h
// HealthKit
//
// Copyright (c) 2013-2018 Apple Inc. All rights reserved.
//
#import <HealthKit/HKActivitySummary.h>
#import <HealthKit/HKActivitySummaryQuery.h>
#import <HealthKit/HKAudiogramSample.h>
#import <HealthKit/HKAnchoredObjectQuery.h>
#import <HealthKit/HKCDADocumentSample.h>
#import <HealthKit/HKCategorySample.h>
#import <HealthKit/HKCharacteristicObjects.h>
#import <HealthKit/HKClinicalRecord.h>
#import <HealthKit/HKClinicalType.h>
#import <HealthKit/HKCorrelation.h>
#import <HealthKit/HKCorrelationQuery.h>
#import <HealthKit/HKCumulativeQuantitySample.h>
#import <HealthKit/HKCumulativeQuantitySeriesSample.h>
#import <HealthKit/HKDefines.h>
#import <HealthKit/HKDeletedObject.h>
#import <HealthKit/HKDevice.h>
#import <HealthKit/HKDiscreteQuantitySample.h>
#import <HealthKit/HKDocumentQuery.h>
#import <HealthKit/HKDocumentSample.h>
#import <HealthKit/HKFHIRResource.h>
#import <HealthKit/HKHealthStore.h>
#import <HealthKit/HKHeartbeatSeriesBuilder.h>
#import <HealthKit/HKHeartbeatSeriesQuery.h>
#import <HealthKit/HKHeartbeatSeriesSample.h>
#import <HealthKit/HKLiveWorkoutBuilder.h>
#import <HealthKit/HKLiveWorkoutDataSource.h>
#import <HealthKit/HKMetadata.h>
#import <HealthKit/HKObject.h>
#import <HealthKit/HKObjectType.h>
#import <HealthKit/HKObserverQuery.h>
#import <HealthKit/HKQuantity.h>
#import <HealthKit/HKQuantitySample.h>
#import <HealthKit/HKQuantitySeriesSampleBuilder.h>
#import <HealthKit/HKQuantitySeriesSampleQuery.h>
#import <HealthKit/HKQuery.h>
#import <HealthKit/HKQueryAnchor.h>
#import <HealthKit/HKSample.h>
#import <HealthKit/HKSampleQuery.h>
#import <HealthKit/HKSeriesBuilder.h>
#import <HealthKit/HKSeriesSample.h>
#import <HealthKit/HKSource.h>
#import <HealthKit/HKSourceQuery.h>
#import <HealthKit/HKSourceRevision.h>
#import <HealthKit/HKStatistics.h>
#import <HealthKit/HKStatisticsCollectionQuery.h>
#import <HealthKit/HKStatisticsQuery.h>
#import <HealthKit/HKTypeIdentifiers.h>
#import <HealthKit/HKUnit.h>
#import <HealthKit/HKWorkout.h>
#import <HealthKit/HKWorkoutBuilder.h>
#import <HealthKit/HKWorkoutConfiguration.h>
#import <HealthKit/HKWorkoutRoute.h>
#import <HealthKit/HKWorkoutRouteBuilder.h>
#import <HealthKit/HKWorkoutRouteQuery.h>
#import <HealthKit/HKWorkoutSession.h>
// ========== HealthKit.framework/Headers/HKHealthStore.h
//
// HKHealthStore.h
// HealthKit
//
// Copyright (c) 2013-2018 Apple Inc. All rights reserved.
//
#import <HealthKit/HKDefines.h>
#import <HealthKit/HKCharacteristicObjects.h>
NS_ASSUME_NONNULL_BEGIN
@class HKDevice;
@class HKObject;
@class HKObjectType;
@class HKQuantity;
@class HKQuantityType;
@class HKQuery;
@class HKSample;
@class HKSampleType;
@class HKSource;
@class HKSourceRevision;
@class HKUnit;
@class HKWorkout;
@class HKWorkoutBuilder;
@class HKWorkoutConfiguration;
@class HKWorkoutSession;
/*!
@class HKHealthStore
@abstract The HKHealthStore class provides an interface for accessing and storing the user's health data.
*/
HK_EXTERN API_AVAILABLE(ios(8.0), watchos(2.0))
@interface HKHealthStore : NSObject
/*!
@method isHealthDataAvailable
@abstract Returns YES if HealthKit is supported on the device.
@discussion HealthKit is not supported on all iOS devices. Using HKHealthStore APIs on devices which are not
supported will result in errors with the HKErrorHealthDataUnavailable code. Call isHealthDataAvailable
before attempting to use other parts of the framework.
*/
+ (BOOL)isHealthDataAvailable;
/*!
@method supportsHealthRecords
@abstract Returns YES if the Health Records feature is available.
@discussion The Health Records feature is not available in all regions but may be present in unsupported regions
if accounts have already been configured. This can change as accounts are modified during device
restore or synchronization.
Call supportsHealthRecords before attempting to request authorization for any clinical types.
*/
- (BOOL)supportsHealthRecords API_AVAILABLE(ios(12.0)) __WATCHOS_PROHIBITED;
/*!
@method authorizationStatusForType:
@abstract Returns the application's authorization status for the given object type.
*/
- (HKAuthorizationStatus)authorizationStatusForType:(HKObjectType *)type;
/*!
@method requestAuthorizationToShareTypes:readTypes:completion:
@abstract Prompts the user to authorize the application for reading and saving objects of the given types.
@discussion Before attempting to execute queries or save objects, the application should first request authorization
from the user to read and share every type of object for which the application may require access.
The request is performed asynchronously and its completion will be executed on an arbitrary background
queue after the user has responded. If the user has already chosen whether to grant the application
access to all of the types provided, then the completion will be called without prompting the user.
The success parameter of the completion indicates whether prompting the user, if necessary, completed
successfully and was not cancelled by the user. It does NOT indicate whether the application was
granted authorization.
To customize the messages displayed on the authorization sheet, set the following keys in your app's
Info.plist file. Set the NSHealthShareUsageDescription key to customize the message for reading data.
Set the NSHealthUpdateUsageDescription key to customize the message for writing data.
*/
- (void)requestAuthorizationToShareTypes:(nullable NSSet<HKSampleType *> *)typesToShare
readTypes:(nullable NSSet<HKObjectType *> *)typesToRead
completion:(void (^)(BOOL success, NSError * _Nullable error))completion;
/*!
@method getRequestStatusForAuthorizationToShareTypes:readTypes:completion:
@abstract Determines whether requesting authorization for the given types is necessary.
@discussion Applications may call this method to determine whether the user would be prompted for authorization if
the same collections of types are passed to requestAuthorizationToShareTypes:readTypes:completion:.
This determination is performed asynchronously and its completion will be executed on an arbitrary
background queue.
*/
- (void)getRequestStatusForAuthorizationToShareTypes:(NSSet<HKSampleType *> *)typesToShare
readTypes:(NSSet<HKObjectType *> *)typesToRead
completion:(void (^)(HKAuthorizationRequestStatus requestStatus, NSError * _Nullable error))completion API_AVAILABLE(ios(12.0), watchos(5.0));
/*!
@method handleAuthorizationForExtensionWithCompletion:
@abstract Prompts the user to authorize the application for reading and saving objects.
@discussion When an app extension calls requestAuthorizationToShareTypes:readTypes:completion:, the parent application
is responsible for calling this method to prompt the user to authorize the app and its extensions for the
types that the extension requested access to.
The request is performed asynchronously and its completion will be executed on an arbitrary background
queue after the user has responded. The success parameter of the completion indicates whether prompting
the user, if necessary, completed successfully and was not cancelled by the user. It does NOT indicate
whether the application was granted authorization.
*/
- (void)handleAuthorizationForExtensionWithCompletion:(void (^)(BOOL success, NSError * _Nullable error))completion API_AVAILABLE(ios(9.0)) API_UNAVAILABLE(watchos) NS_EXTENSION_UNAVAILABLE("Not available to extensions");
/*!
@method earliestPermittedSampleDate
@abstract Samples prior to the earliestPermittedSampleDate cannot be saved or queried.
@discussion On some platforms, only samples with end dates newer than the value returned by earliestPermittedSampleDate
may be saved or retrieved.
*/
- (NSDate *)earliestPermittedSampleDate API_AVAILABLE(ios(9.0), watchos(2.0));
/*!
@method saveObject:withCompletion:
@abstract Saves an HKObject.
@discussion After an object is saved, on subsequent retrievals the sourceRevision property of the object will be set
to the HKSourceRevision representing the version of the application that saved it.
If the object has an HKObjectType property, then in order to save an object successfully the application
must first request authorization to share objects with that type. Saving an object with the same unique
identifier as another object that has already been saved will fail. When the application attempts to
save multiple objects, if any single object cannot be saved then none of the objects will be saved.
The operation will fail if the objects array contains samples with endDates that are older than the date
returned by earliestPermittedSampleDate.
This operation is performed asynchronously and the completion will be executed on an arbitrary
background queue.
*/
- (void)saveObject:(HKObject *)object withCompletion:(void(^)(BOOL success, NSError * _Nullable error))completion;
/*!
@method saveObjects:withCompletion:
@abstract Saves an array of HKObjects.
@discussion See discussion of saveObject:withCompletion:.
*/
- (void)saveObjects:(NSArray<HKObject *> *)objects withCompletion:(void(^)(BOOL success, NSError * _Nullable error))completion;
/*!
@method deleteObject:withCompletion:
@abstract Deletes a single HKObject from the HealthKit database.
@discussion See deleteObjects:withCompletion:.
*/
- (void)deleteObject:(HKObject *)object withCompletion:(void(^)(BOOL success, NSError * _Nullable error))completion;
/*!
@method deleteObjects:withCompletion:
@abstract Deletes multiple HKObjects from the HealthKit database.
@discussion An application may only delete objects that it previously saved. This operation is performed
asynchronously and the completion will be executed on an arbitrary background queue.
*/
- (void)deleteObjects:(NSArray<HKObject *> *)objects withCompletion:(void(^)(BOOL success, NSError * _Nullable error))completion API_AVAILABLE(ios(9.0), watchos(2.0));
/*!
@method deleteObjectsOfType:predicate:withCompletion:
@abstract Deletes all objects matching the given predicate from the HealthKit database.
@discussion An application may only delete objects that it previously saved. This operation is performed
asynchronously and the completion will be executed on an arbitrary background queue.
*/
- (void)deleteObjectsOfType:(HKObjectType *)objectType predicate:(NSPredicate *)predicate withCompletion:(void(^)(BOOL success, NSUInteger deletedObjectCount, NSError * _Nullable error))completion API_AVAILABLE(ios(9.0), watchos(2.0));
/*!
@method executeQuery:
@abstract Begins executing the given query.
@discussion After executing a query, the completion, update, and/or results handlers of that query will be invoked
asynchronously on an arbitrary background queue as results become available. Errors that prevent a
query from executing will be delivered to one of the query's handlers. Which handler the error will be
delivered to is defined by the HKQuery subclass.
Each HKQuery instance may only be executed once and calling this method with a currently executing query
or one that was previously executed will result in an exception.
If a query would retrieve objects with an HKObjectType property, then the application must request
authorization to access objects of that type before executing the query.
*/
- (void)executeQuery:(HKQuery *)query;
/*!
@method stopQuery:
@abstract Stops a query that is executing from continuing to run.
@discussion Calling this method will prevent the handlers of the query from being invoked in the future. If the
query is already stopped, this method does nothing.
*/
- (void)stopQuery:(HKQuery *)query;
/*!
@method splitTotalEnergy:startDate:endDate:resultsHandler:
@abstract For the time period specified, this method calculates the resting and active energy parts of the total
energy provided.
@discussion This method uses the user's metrics like age, biological sex, body mass and height to determine
their basal metabolic rate. If the application does not have authorization to access these characteristics
or if the user has not entered their data then this method uses builtin default values.
*/
- (void)splitTotalEnergy:(HKQuantity *)totalEnergy
startDate:(NSDate *)startDate
endDate:(NSDate *)endDate
resultsHandler:(void(^)(HKQuantity * _Nullable restingEnergy, HKQuantity * _Nullable activeEnergy, NSError * _Nullable error))resultsHandler API_DEPRECATED("No longer supported", ios(9.0, 11.0), watchos(2.0, 4.0));
- (nullable NSDate *)dateOfBirthWithError:(NSError **)error API_DEPRECATED_WITH_REPLACEMENT("dateOfBirthComponentsWithError:", ios(8.0, 10.0), watchos(2.0, 3.0));
/*!
@method dateOfBirthComponentsWithError:
@abstract Returns the user's date of birth in the Gregorian calendar.
@discussion Before calling this method, the application should request authorization to access objects with the
HKCharacteristicType identified by HKCharacteristicTypeIdentifierDateOfBirth.
*/
- (nullable NSDateComponents *)dateOfBirthComponentsWithError:(NSError **)error API_AVAILABLE(ios(10.0), watchos(3.0));
/*!
@method biologicalSexWithError:
@abstract Returns an object encapsulating the user's biological sex.
@discussion Before calling this method, the application should request authorization to access objects with the
HKCharacteristicType identified by HKCharacteristicTypeIdentifierBiologicalSex.
*/
- (nullable HKBiologicalSexObject *)biologicalSexWithError:(NSError **)error;
/*!
@method bloodTypeWithError:
@abstract Returns an object encapsulating the user's blood type.
@discussion Before calling this method, the application should request authorization to access objects with the
HKCharacteristicType identified by HKCharacteristicTypeIdentifierBloodType.
*/
- (nullable HKBloodTypeObject *)bloodTypeWithError:(NSError **)error;
/*!
@method fitzpatrickSkinTypeWithError:
@abstract Returns an object encapsulating the user's Fitzpatrick skin type.
@discussion Before calling this method, the application should request authorization to access objects with the
HKCharacteristicType identified by HKCharacteristicTypeIdentifierFitzpatrickSkinType.
*/
- (nullable HKFitzpatrickSkinTypeObject *)fitzpatrickSkinTypeWithError:(NSError **)error API_AVAILABLE(ios(9.0), watchos(2.0));
/*!
@method wheelchairUseWithError:
@abstract Returns an object encapsulating the user's wheelchair use.
@discussion Before calling this method, the application should request authorization to access objects with the
HKCharacteristicType identified by HKCharacteristicTypeIdentifierWheelchairUse.
*/
- (nullable HKWheelchairUseObject *)wheelchairUseWithError:(NSError **)error API_AVAILABLE(ios(10.0), watchos(3.0));
@end
@interface HKHealthStore (HKWorkout)
/*!
@method addSamples:toWorkout:completion:
@abstract Associates samples with a given workout.
@discussion This will associate the given samples with the given workout. These samples will then be returned by a
query that contains this workout as a predicate. If a sample is added that is not saved yet, then it will
be saved for you. Note that the sample will be saved without an HKDevice.
The workout provided must be one that has already been saved to HealthKit.
*/
- (void)addSamples:(NSArray<HKSample *> *)samples toWorkout:(HKWorkout *)workout completion:(void(^)(BOOL success, NSError * _Nullable error))completion;
/*!
@method startWorkoutSession:
@abstract Starts the given workout session.
@discussion This method will asynchronously begin a workout session. The methods on the session's delegate will be
called when the session has successfully started or fails to start.
*/
- (void)startWorkoutSession:(HKWorkoutSession *)workoutSession API_DEPRECATED("Use HKWorkoutSession's start method", watchos(2.0, 5.0)) __IOS_PROHIBITED;
/*!
@method endWorkoutSession:
@abstract Ends the given workout session.
@discussion This method will end the given session if it is currently running. The state of the workout session will
transition to HKWorkoutSessionStateEnded. Once a workout session is ended, it cannot be reused to start
a new workout session.
*/
- (void)endWorkoutSession:(HKWorkoutSession *)workoutSession API_DEPRECATED("Use HKWorkoutSession's end method", watchos(2.0, 5.0)) __IOS_PROHIBITED;
/*!
@method pauseWorkoutSession:
@abstract Pauses the given workout session.
@discussion This method will pause the given session if it is currently running. The state of the workout session
will transition to HKWorkoutSessionStatePaused. An HKWorkoutEventTypePause will be generated and
delivered to the workout session's delegate.
*/
- (void)pauseWorkoutSession:(HKWorkoutSession *)workoutSession API_DEPRECATED("Use HKWorkoutSession's pause method", watchos(3.0, 5.0)) __IOS_PROHIBITED;
/*!
@method resumeWorkoutSession:
@abstract Resumes the given workout session.
@discussion This method will resume the given session if it is currently paused. The state of the workout session
will transition to HKWorkoutSessionStateRunning. An HKWorkoutEventTypeResume will be generated and
delivered to the workout session's delegate.
*/
- (void)resumeWorkoutSession:(HKWorkoutSession *)workoutSession API_DEPRECATED("Use HKWorkoutSession's resume method", watchos(3.0, 5.0)) __IOS_PROHIBITED;
/*!
@method startWatchAppWithWorkoutConfiguration:completion:
@abstract Launches or wakes up the WatchKit app on the watch
@discussion This method will launch the WatchKit app corresponding to the calling iOS application on the currently
active Apple Watch. After launching, the handleWorkoutConfiguration: method on the WKExtensionDelegate
protocol will be called with the HKWorkoutConfiguration as a parameter. The receiving Watch app can use
this configuration object to create an HKWorkoutSession and start it with -startWorkoutSession:.
*/
- (void)startWatchAppWithWorkoutConfiguration:(HKWorkoutConfiguration *)workoutConfiguration completion:(void (^)(BOOL success, NSError * _Nullable error))completion API_AVAILABLE(ios(10.0)) API_UNAVAILABLE(watchos);
/*!
@method recoverActiveWorkoutSessionWithCompletion:
@abstract Recovers an active workout session after a client crash. If no session is available to be re-attached,
nil will be returned. If an error occurs, session will be nil and error will be set appropriately.
*/
- (void)recoverActiveWorkoutSessionWithCompletion:(void (^)(HKWorkoutSession * _Nullable session, NSError * _Nullable error))completion API_AVAILABLE(watchos(5.0)) __IOS_PROHIBITED;
@end
@interface HKHealthStore (HKBackgroundDelivery)
/*!
@method enableBackgroundDeliveryForType:frequency:withCompletion:
@abstract This method enables activation of your app when data of the type is recorded at the cadence specified.
@discussion When an app has subscribed to a certain data type it will get activated at the cadence that is specified
with the frequency parameter. The app is still responsible for creating an HKObserverQuery to know which
data types have been updated and the corresponding fetch queries. Note that certain data types (such as
HKQuantityTypeIdentifierStepCount) have a minimum frequency of HKUpdateFrequencyHourly. This is enforced
transparently to the caller.
*/
- (void)enableBackgroundDeliveryForType:(HKObjectType *)type frequency:(HKUpdateFrequency)frequency withCompletion:(void(^)(BOOL success, NSError * _Nullable error))completion __WATCHOS_PROHIBITED;
- (void)disableBackgroundDeliveryForType:(HKObjectType *)type withCompletion:(void(^)(BOOL success, NSError * _Nullable error))completion __WATCHOS_PROHIBITED;
- (void)disableAllBackgroundDeliveryWithCompletion:(void(^)(BOOL success, NSError * _Nullable error))completion __WATCHOS_PROHIBITED;