Recently we got approved by Apple to use SensorKit. Here are all prerequisites I checked:
- I'm pretty sure the project is configured properly. Entitlements file contains list of all sensors, Info.plist contains
NSSensorKitUsageDescription,NSSensorKitUsageDetailandNSSensorKitPrivacyPolicyURL. - When I request authorization for a sensor (e.g. accelerometer) the system dialog is presented, I approve it and it's clearly allowed in phone
Settings -> Privacy -> Research Sensor & Usage Datasection - I started recording for a sensor
- I waited more than 24h (6 days actually)
- I created
SRFetchRequest(see the code below) with correct time interval
let 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?