iosswiftpermissionscore-motion

How can I check whether or not Motion & Fitness is enabled on an iOS device?


I know how to check whether or not Motion & Fitness is available on the user's device using CMMotionActivityManager.isActivityAvailable(), and I know how to check whether or not Motion & Fitness permission has been granted to the app using CMMotionActivityManager.authorizationStatus() == .authorized, but I need to be able to check whether or not the user has Motion & Fitness enabled on their device via their Settings -> Privacy -> Motion & Fitness. Is this possible?


Solution

  • You want CMMotionActivityManager.authorizationStatus() == .restricted although the Apple docs could be clearer around this.

    Additionally from my testing the authorizationStatus stays restricted until the App is re-launched which confuses things further. You will need to inform users to re-launch the App after toggling the setting.