How to create sleep sessions from sleep stages received from health kit ios

93 Views Asked by At

I plan to create sleep sessions from sleep stages received from Apple's health kit.

Idea is to get a particular inBed time. Then retrieve all sleep stages that come in between the start and stop of the in bed time.

One problem I face is that multiple sources (Apple Watch, noisefit etc) can add sleep data to health kit. How can I differentiate between sources?

Can I use HKCategorySample.sourceRevision.source.name or .sourceRevision.source.bundleIdentifier to differentiate the sources of data.

0

There are 0 best solutions below