HealthKit Development Quick Start Tutorial College Bully Internal Tutorial
The first domestic HealthKit specificity tutorial. This tutorial explains in detail how to use the HealthKit framework to develop healthy apps in iOS. Finally, this tutorial combines HealthKit and Apple Watch iwatch for a fitness application-a stand-up pat.
Probation: Http://pan.baidu.com/s/1o6iLO2A
Directory
1th Chapter HealthKit Development Overview ... 1
1.1 HealthKit Introduction ... 1
1.1.1 HealthKit features ... 1
1.1.2 HealthKit Classic Application ... 1
1.2 HealthKit Development Preparation work ... 4
1.2.1 HealthKit frame system ... 4
1.2.2 Health app. 5
1.2.3 Create app ID special needs ... 6
The 2nd chapter shows the data ... 7
2.1 Operation of data ... 7
2.1.1 Create Data ... 7
2.1.2 Judging, comparing data ... 8
2.1.3 Get Data ... 11
2.2 Primary type data ... 12
2.2.1 Length type data ... 12
2.2.2 Quality type of data ... 17
2.2.3 Energy Type data ... 22
2.3 Auxiliary Data ... 25
2.3.1 Volume type data ... 25
2.3.2 Pressure type data ... 28
2.3.3 Time-type data ... 30
2.3.4 Temperature Type data ... 31
2.3.5 Scalar type data ... 32
2.3.6 conductivity type data ... 33
2.4 Composite data ... 34
2.4.1 Multiply the resulting composite data ... 34
2.4.2 Divide the resulting composite data ... 35
2.4.3 composite data consisting of units and integers of the sub-square ... 35
2.4.4 the reciprocal composition of the compound unit ... 36
The 3rd chapter of the sample object ... 37
3.1 Composition of the sample object ... 37
3.1.1 Unique identifier ... 37
3.1.2 Data Sources ... 38
3.1.3 Meta data ... 38
3.1.4 Sample Type ... 39
3.1.5 Sample Time ... 39
3.2 Basic Quantity Sample ... 39
3.2.1 Create a base Quantity Sample object ... 39
3.2.2 Get the information from the base quantity sample ... 45
3.2.3 Heart Rate Sample ... 48
3.2.4 Temperature Sample ... 49
3.3 Status Sample ... 51
3.3.1 Creating a Status Sample object ... 51
3.3.2 Get information from the status sample ... 54
3.4 Composite Data Sample ... 55
3.4.1 Creating a composite data sample object ... 56
3.4.2 get information from a composite data sample ... 59
3.4.3 Food Sample ... 61
3.5 Fitness Samples ... 62
3.5.1 Create a fitness sample ... 62
3.5.2 get information from a fitness sample ... 68
3.5.3 Fitness Sample ... 69
The 4th chapter of the sample general treatment ... 71
4.1 Preparation work ... 71
4.1.1 Determine if HealthKit is available ... 71
4.1.2 Licensing Management ... 72
4.2 Sample General Processing ... 81
4.2.1 Adding a Sample object ... 81
4.2.2 Delete a Sample object ... 97
4.2.3 Get default units ... 104
4.3 Manage background updates ... 109
4.3.1 Start background update ... 109
4.3.2 Turn off background updates ... 113
The 5th Chapter Basic Inquiry ... 119
5.1 Overview ... 119
How to implement 5.1.1 query ... 119
5.1.2 The operation type of the query ... 120
5.2 Set up a query ... 120
5.2.1 UUID Query ... 120
5.2.2 Data Source Query ... 125
5.2.3 meta-data query ... 129
5.2.4 query for non-composite data ... 139
5.3 Sample Query ... 142
5.3.1 Basic Quantity Sample Query ... 142
5.3.2 Status Sample Query ... 146
5.3.3 composite Data Sample Query ... 148
5.3.4 Fitness Sample Query ... 153
5.3.5 General Sample Query ... 165
5.4 Advanced Query ... 168
5.4.1 Viewer Query ... 168
5.4.2 Anchor Query ... 173
The 6th Chapter Special Inquiry ... 179
6.1 Feature data Query ... 179
6.1.1 User gender data ... 179
6.1.2 user blood type data ... 180
6.1.3 User Birth date data ... 180
6.2 Data Source Query ... 187
6.3 Statistics Query ... 190
6.3.1 build a statistical query ... 190
6.3.2 basic information for statistical objects ... 191
6.3.3 Get Statistics ... 194
6.3.4 Specify the data source ... 199
6.3.5 blood pressure ... 204
6.4 Statistics Collection Query ... 209
6.4.1 Building Statistics Collection Query ... 209
6.4.2 Statistics Collection Query the basic information of the object ... 210
6.4.3 Analysis Results ... 212
6.4.4 Number of steps ... 215
7th. Apple Watch+healthkit Project ... 220
7.1 Apple Watch Introduction ... 220
7.1.1 Apple Watch Development ... 220
7.1.2 Apple Watch features ... 220
7.2 Stand-up racquet ... 223
7.2.1 Create an Apple Watch app ... 224
7.2.2 know Apple Watch simulator ... 226
7.2.3 Design Apple Watch interface ... 228
7.2.4 Chronograph function ... 230
7.2.5 Count Function ... 233
7.2.6 saved to HealthKit store ... 234
Appendix A Health Kit class method/property sheet ... 239
Table Hkanchoredobjectquery members of the class ... 239
Table Hkbiologicalsexobject members of the class ... 239
Table Hkbloodtypeobject members of the class ... 239
Table Hkcategorysample members of the class ... 239
Table Hkcorrelation members of the class ... 239
Table Hkcorrelationquery members of the class ... 240
Table Hkhealthstore members of the class ... 240
Table Hkobject members of the class ... 241
Table Hkobjecttype members of the class ... 242
Table Hkobserverquery members of the class ... 242
Table Hkquantity members of the class ... 242
Table Hkquantitysample members of the class ... 242
Table Hkquantitytype members of the class ... 243
Table Hkquery members of the class ... 243
Table Hksample members of the class ... 244
Table Hksamplequery members of the class ... 244
Table Hksource members of the class ... 245
Table Hksourcequery members of the class ... 245
Table Hkstatistics members of the class ... 245
Table Hkstatisticscollection members of the class ... 245
Table Hkstatisticscollectionquery members of the class ... 247
Table Hkstatisticsquery members of the class ... 247
Table Hkunit members of the class ... 247
Table Hkworkout members of the class ... 249
Table Hkworkoutevent members of the class ... 250
Appendix B: Basic units supported by Health kit ... 250
HealthKit Development Quick Start Tutorial College Bully Internal Tutorial