Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9127333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:15:32+00:00 2026-06-17T07:15:32+00:00

CMCalibratedMagneticField returns 0 all the time. CMAcceleration returns values, CMMagnetometerData returns values too. Only

  • 0

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)];

    }];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:15:34+00:00Added an answer on June 17, 2026 at 7:15 am

    Have you checked the magnetometer accuracy? My guess is your value for motion.magneticField.accuracy will be -1 (uncalibrated). Unfortunately I have no idea why this is. I’m getting the same thing with my iPhone 4, even though the magnetometer is working just fine.

    The only thing I can figure is that the phone was never calibrated before leaving the factory, but that makes more sense for my 4 than for your 4S. The calibrated field feature was new for iOS 5.0 which was publicly released in October 2011, where as the iPhone 4 was released over a year before. But your phone came out right along with 5.0, so one would think that the hardware being released would match the software capability it was supporting. Again, just speculation. Sorry I can’t be more help. Hopefully you’ll find a real answer. I just plan on calibrating the magnetometer myself.

    Freescale provides a free tool for doing this. The software (and some useful documentation) is available here. You might have to create a free account to download it, but I can’t remember.

    http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=eCompass

    UPDATE: I got a hold of an iPhone 5 and the CMCalibratedMagneticField worked just fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.