CMSensorRecorder.accelerometerDataSince(_:) missing?

Fritz Anderson

Xcode 11, targeted at 13 or 12.x (no difference to this issue).

I need to accumulate accelerometer data from Core Motion over long periods of time (I’m aware of the 12-hour / 3-day limits). The class reference includes

func accelerometerDataSince(_ identifier: UInt64) -> CMSensorDataList?

which would be ideal, because you can keep the batch ID for the last records you retrieved, pass it to this func, and get only and exactly the subsequent records. No calculations or races.

Xcode 11 won’t complete the symbol; it raises an error when I try to use it anyway; and the derived interface for the class doesn’t include it.

On top of this, the Class Reference lists the function.

On top of THAT, the headword for the function is “accelerometerDataSince:” — ObjC idiom.


The alternative, accelerometerData(from:to:), looks error-prone. You could pass distant-past (or first-run) to “from”, and then the latest-reported timestamp from the previous fetch (plus a millisecond, the two limits are _inclusive_).

But the docs say there is a lag of up to 3 minutes between recording a record and its availability through the API: (… to: Date()) won’t get you all the data already captured. If I pass only the last-_reported_ date (plus a millisecond) to the from: in the next call, that should be fine. I’d expect the request for records in the 3-minute gap not to taint the “from” in the next request.

But I’m not paid to be optimistic.


Am I confined to this accelerometerData(from:to:) dance, or am I missing something? The compiler and the generated interface seem to be pretty definitive.

— F

Join to automatically receive all group messages.