Recently we got approved by Apple to use SensorKit. Here are all prerequisites I checked:
NSSensorKitUsageDescription
, NSSensorKitUsageDetail
and NSSensorKitPrivacyPolicyURL
.Settings -> Privacy -> Research Sensor & Usage Data
sectionSRFetchRequest
(see the code below) with correct time intervallet now = Date()
let from = Date(timeInterval: -3 * 24 * 60 * 60, since: now) as NSDate
let to = Date(timeInterval: -2 * 24 * 60 * 60, since: now) as NSDate
let request = SRFetchRequest()
request.device = SRDevice.current
request.from = from.srAbsoluteTime
request.to = to.srAbsoluteTime
reader.fetch(request)
What's interesting, no error is triggered. Actually the func sensorReader(_ reader: SRSensorReader, didCompleteFetch fetchRequest: SRFetchRequest)
delegate method is invoked but func sensorReader(_ reader: SRSensorReader, fetching fetchRequest: SRFetchRequest, didFetchResult result: SRFetchResult<AnyObject>) -> Bool
method never gets called.
Did anyone make it working? Any ideas why it's not working?
For those interested I found an issue. I tried to collect them from my Apple Watch series 3 that are probably not supported. With series 6 (or from iPhone) it works correctly. Interestingly devices support isn't documented anywhere...