Search code examples
iosiphonecore-motioncmmotionmanager

CMMotionactivitymanager authorizationstatus


I want to get the authorization status for CMMotionActivityManager. For other services like calendar and location we have some property in the API that gives us the user authorization status for these classes. How i can get the authorization status for CMMotionActivityManager class?


Solution

  • CMMotionActivityManager does not currently offer a way to check authorisation status directly like other frameworks.

    iOS - is Motion Activity Enabled in Settings > Privacy > Motion Activity

    However, as the comments in the above question mention, if you attempt a query using

    queryActivityStartingFromDate:toDate:toQueue:withHandler
    

    and the user has not authorised your application, the handler (CMMotionActivityQueryHandler) will return this error.

    CMErrorMotionActivityNotAuthorized