Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 249
Madu Avatar asked Apr 29 '14 09:04

Madu


2 Answers

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
like image 69
Brandon Schlenker Avatar answered Sep 27 '22 19:09

Brandon Schlenker


With introduction of IOS 11.* there is the possibility to call CMMotionActivityManager.authorizationStatus() which gives you a detailed status.

like image 34
Hardy_Germany Avatar answered Sep 27 '22 17:09

Hardy_Germany