accelerometer - unable to implement CMMotionManager with ios app -
I am trying to change the UILBL value if we tilt the device, I try to implement CMMotionManager But I am not working for this, I am using this code,
I have added CoreMotion to Lib.
#import & lt; CoreMotion / CoreMotion.h & gt; CMMotion Manager * motionManager = [[CMMotionManager alloc] init]; MotionManager.accelerometerUpdateInterval = .2; [Motionmanager startAccelerometer update]; If ([Motion Manager is Accelerometer available] == Yes) {NSOction QE * Q = [[NSOperation QUE Elok] INS]; [Queue setmaxconverter operation count: 1]; [Motionmanager startAccelerometerUpdatesToQueue: Handler with queue: ^ (CMAccelerometerData * data, NSError * error) {CMAcceleration acceleration = data.acceleration; If (Acceleration.A <-0.25) {// Tilt the device to the right [self-satexilabel: @ "right"]; } And if (acceleration.Y> 0.25) {// Touch the device on the left [Self-Setteurelabel: @ "left"]; }}]; }
Here's the problem, isAccelerometer is available
is always false and
startAccelerometerUpdatesToQueue
not in the fire
"post-text" itemprop = "text"
>
Do you run it on the device or do not work in the stimulant accelerator accelerator
Comments
Post a Comment