NOTICE: This question was originally posted before Apple introduced motion-detection hardware and associated APIs in the iOS SDK. Answers to
Xcode 7.3, iOS 9.3
Thanks to all the original contributors.
I just spent a few hours trying to understand why this fairly straight forward class was not working for me. I used all the suggestion above and from other posts to see what activity iOS thought the user was performing using Core Motion framework and using the CMMotionActivityManager
class.
Turns out that for whatever reason I had my "Fitness Tracking" in "Settings"->"Privacy"->"Motion & Fitness" turned off. And for whatever reason after adding the framework and calling a CM class, the app. did not request to enable this. I must have turned this off manually.
Eventually I stumbled onto this post...
iOS - is Motion Activity Enabled in Settings > Privacy > Motion Activity
Which lead me to check the setting and resolve the issue. After I flipped "Fitness Tracking" to on and ran the app. again, everything worked like a charm.
Hopefully this saves someone some time! Cheers.