-1

Apple says: You should only create a single instance of CMMotionManager to get accurate data.

What if I want to start the device motion updates when the app starts and then take the updatesToQueue at multiple places.

Scenario is something like this:

App starts - Start device motion updates without handler

ClassA - Start device motion updates to queue at a particular time.

ClassB - Start device motion updates to queue at a particular time.

Stop device motion updates when required.

nr5
  • 4,228
  • 8
  • 42
  • 82

1 Answers1

1

Start CMMotionManager with a handler that posts notifications (see NSNotificationCenter). Your other classes can then listen for that notification when needed.

Steve Wilford
  • 8,894
  • 5
  • 42
  • 66