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 ?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
From the document https://developer.apple.com/documentation/sensorkit/srfetchrequest we know that "SensorKit places a 24-hour holding period on newly recorded data before an app can access it. This gives the user an opportunity to delete any data they don’t want to share with the app. A fetch request doesn’t return any results if its time range overlaps this holding period."
Will this holding period reset each time when I called startRecording() ?
Let's say I upgrade my app to a new version, do I need to call startRecording again to init the data collection process? will it be able to query the data collected from previous version's app ?