CMCalibratedMagneticField
returns 0
all the time.
CMAcceleration
returns values, CMMagnetometerData
returns values too.
Only CMCalibratedMagneticField
doesn't, I need it because it is the magneticfield without bias.
I'm testing on iPhone 4S.
[MotionManager startDeviceMotionUpdatesToQueue:deviceQueue
withHandler:^(CMDeviceMotion *motion, NSError *error) {
CMCalibratedMagneticField f = motion.magneticField;
//CMMagneticField t = motion.;
//CMAcceleration s = motion.gravity; Works!
//_xlabelnew.text = [NSString stringWithFormat:@"%f", s.x];
_xlabelnew.text = [NSString stringWithFormat:@"%f", f.field.x];
_ylabelnew.text = [NSString stringWithFormat:@"%f", f.field.y];
_zlabelnew.text = [NSString stringWithFormat:@"%f", f.field.z];
//_totallabelnew.text = [NSString stringWithFormat:@"%f", sqrt(f.field.x*f.field.x + f.field.y*f.field.y + f.field.z*f.field.z)];
}];