Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was just having this same problem, and wouldn't you know it, the solution was in the documentation ;)</p> <p>The problem is with the block format. All of the tutorials seem to favor that method, but Apple recommends periodic polling of the <code>CMMotionManager</code> as a more performance oriented approach. The block format adds overhead.</p> <p>From the <code>CMMotionManager</code> Class Reference:</p> <blockquote> <p>To handle motion data by periodic sampling, the app calls a “start” method taking no arguments and periodically accesses the motion data held by a property for a given type of motion data. This approach is the recommended approach for apps such as games. Handling accelerometer data in a block introduces additional overhead, and most game apps are interested only the latest sample of motion data when they render a frame.</p> </blockquote> <p>So what you want to do, from the docs again:</p> <blockquote> <p>Call startAccelerometerUpdates to begin updates and periodically access CMAccelerometerData objects by reading the accelerometerData property.</p> </blockquote> <p>Something along these lines</p> <pre><code>CMMotionManager *mManager = [(AppDelegate *)[[UIApplication sharedApplication] delegate] sharedManager]; [mManager startAccelerometerUpdates]; </code></pre> <p>Then, in some sort of periodically updating method of your choosing:</p> <pre><code>CMMotionManager *mManager = [(SEPAppDelegate *)[[UIApplication sharedApplication] delegate] sharedManager]; CMAccelerometerData *aData = mManager.accelerometerData; </code></pre> <p>This solution appears to work as well as <code>UIAccelerometer</code> on an iPhone 4 from the limited testing I've done.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload