Reputation: 1
hi I want to get the acceleration of my iPhone but I dont want the acceleration values to change when the iPhone is tilted. and I think the answer is the userAcceleration. but I don't know how to get the userAcceleration values. I know that I have to use the core motion and use the CMdeviceMotion but i don't know how to initialize and set it up.
Upvotes: 0
Views: 456
Reputation: 108
I know this question was asked awhile ago, but I'm hoping I can provide some interesting perspective if you're still interested.
userAcceleration will provide watered-down (not raw) data comprised of sets of acceleration & gyroscopic information. You can get the raw acceleration data from CMMotionManager with the method -accelerometerData:
Unfortunately, the purpose of the accelerometer on the iOS device is to determine movement and orientation in a 3-dimensional axis: X, Y and Z coordinates. The iOS system doesn't differentiate between "tilting" and "movement" - they're one in the same. I don't know what purpose you have for divvying out the too, but that's what's laid out in the CoreMotion framework for us.
Upvotes: 1