How to reset the `CMMontionManager`` relation`

I want to reset CMMotionManager attitude, so it rotationMatrixindicates a "front" (that is, the rotation of the device around the axis of gravity to its original position). This behavior is when you call -startDeviceMotionUpdatesdisconnected CMMotionManager.

After starting the motion controller, if you call -stopDeviceMotionUpdates, wait a while and then call again -startDeviceMotionUpdates, I get the behavior I'm looking for.

However, attitudedo not reset if you call -stopDeviceMotionUpdatesand immediately call -startDeviceMotionUpdatesagain; he retains his former attitude. Creating a new one CMMotionManagerleads to the same results (I think the motion control system is singleton under the hood).

Is there a way to make sure that the iOS motion manager inside attitudeis reset without entering artificial or arbitrary delays

+4
source share

Source: https://habr.com/ru/post/1651468/


All Articles