We tried to fetch the recorded PPG data using SensorKit with the following code, however the didFetchResult callback method is never called.
let ppgReader = SRSensorReader(sensor: .photoplethysmogram)
let request = SRFetchRequest()
let nowDate = Date()
let toDate = nowDate.addingTimeInterval(-25 * 60 * 60)
let fromDate = toDate.addingTimeInterval(-24 * 60 * 60)
request.from = SRAbsoluteTime.fromCFAbsoluteTime(_cf: fromDate.timeIntervalSinceReferenceDate)
request.to = SRAbsoluteTime.fromCFAbsoluteTime(_cf: toDate.timeIntervalSinceReferenceDate)
ppgReader.delegate = self;
ppgReader.fetch(request)
The delegate called the didComplete successfully:
func sensorReader(_ reader: SRSensorReader, didCompleteFetch fetchRequest: SRFetchRequest)
But never called the didFetchResult
func sensorReader(_ reader: SRSensorReader, fetching fetchRequest: SRFetchRequest, didFetchResult result: SRFetchResult<AnyObject>) -> Bool
Any ideas why ? (I am wearing the watch for couple days and ensure it has the data for the time period I am querying)
One thing I notice is when Apple granted us the entitlement, it uses Uppercase for ECG and PPG, however the document use Lowercases in the plist https://developer.apple.com/documentation/sensorkit/srsensor/photoplethysmogram
Dose it matter ?