From the course: Advanced iOS App Development: Core Motion

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Reading Core Motion data

Reading Core Motion data - iOS Tutorial

From the course: Advanced iOS App Development: Core Motion

Start my 1-month free trial

Reading Core Motion data

- [Instructor] A sensor works on its own timescale, not on the same timescale that your iPhone, iPad, or Apple Watch does. There's two strategies that Core Motion uses to handle input from the sensors. The first option is the push option. The push option pushes the data back to the app after every reading of the sensor. It uses a closure in the sensor start method to do this. We'll cover the details of this method later. Pushing data is the most accurate and robust set of data you can get. It gives you all the data. That may be too much data, and it can clog up the app's efficiency. You will run push updates on a separate thread than the main thread to keep it from clogging up, but it still may be more data than you need. The other option is the pull method. Pulling reads the sensor in a timing loop. At given intervals, the application checks with the sensors for data. At the given time interval, you'll have some code to handle the updates coming from the sensors reading their data…

Contents