سؤال

I'm trying to use magnetometer:

[myMotionMngr startDeviceMotionUpdatesToQueue: [NSOperationQueue currentQueue]
                                  withHandler:^(CMDeviceMotion *motion, NSError *error) 
{
    printf("%f\t%f\t%f\n", motion.magneticField.field.x, motion.magneticField.field.y, motion.magneticField.field.z);
    CMMagneticFieldCalibrationAccuracy acc = motion.magneticField.accuracy;
}];

And the filed (x,y,z) is always 0. motion.magneticField.accuracy is always CMMagneticFieldCalibrationAccuracyUncalibrated. According to docs it means that my device has got no magnetometer, however it is no true cause I'm testing on iPad2 with iOS 5.0.

What am I missing?

هل كانت مفيدة؟

المحلول

try

startDeviceMotionUpdatesUsingReferenceFrame:toQueue:withHandler:

it should work

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top