CoreMotion - way to determine if motion is disabled in iOS Settings?

1.4k views Asked by At

On iOS 7 the user can choose disable device motion in Settings -> General -> Accessibility -> Reduce Motion.

I am creating a UI effect based on UITableView scrolling, so I am not using CMMotionManager or the CoreMotion framework to create any motion effects.

However, I would like to respect the user's settings and not create the motion effect if the user has turned on Reduce Motion in Settings.

CMMotionManager includes an instance method deviceMotionActive to check for whether it's active (I'm assuming this is the correct check), however, I'd prefer not having to initialize the manager just to do this check, sadly I cannot find any documentation about a class method that would return a similar boolean, sort of like there exist class methods on MFMessageComposeViewController to check for iMessage/SMS availability (+(BOOL)canSendText) and so on.

Thanks!

1

There are 1 answers

2
SwampThingTom On BEST ANSWER

You are confusing two separate things called "motion". CMMotionManager is used to access the sensors, such as the gyroscope and accelerometer, that report how a user physically moves a device. It has nothing to do with the motion effects, like UIMotionEffect objects, that are used in animating views.

The deviceMotionActive method merely indicates whether your app is currently registered for receiving motion updates from CoreMotion. This will only be true if your app has called one of the CMMotionManager startXXXUpdate methods. Again, it has nothing to do with user settings or UIMotionEffect objects.

UPDATE: As John mentions in the comments, there appears to be an API for this in iOS 8: See stackoverflow.com/a/25453082/2904769 .