I've tried several method but I cannot find a working method to replace my
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / kAccelerometerFrequency)];
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
most recently i've tried to replace that with
motionManager = [[CMMotionManager alloc] init];
motionManager.accelerometerUpdateInterval = (1.0 / kAccelerometerFrequency);
But it does not seem to work with my void
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
CGPoint pt = theCar.center;
CGFloat accel = acceleration.x * kAccelerationSpeed;
float halfCarWidth = theCar.frame.size.width / 2;
if(pt.x - halfCarWidth + accel > 0 && pt.x + halfCarWidth + accel < 320) {
pt.x += accel;
}
[theCar setCenter:pt];
}
So what do I replace the sharedAccelerometer with since it was depreciated in iOS 5