Compass calibration dialog causing app to go berzerk

I filed a Radar bug on this several weeks ago, and unfortunately it still exists in the 9.0 GM. My app uses Core Motion, and whenever the Compass Calibration dialog appears it causes the app to go bonkers. The dialog will randomly flash and disappear. Each time it does this I get an -applicationWillResignActive, and -applicationDidBecomeActive call. It's like the calibration dialog is a separate app that randomly switches with my own app.


Occasionally, the calibration screen will appear and stay. It seems to work, and I can do the calibration, but once I get all the ticks ticked it freezes up. If I hit the Home button to exit out, it actually causes the calibration screen to disappear, and then control returns to my app. So, it definitely appears that the Compass Calibration screen is a separate app, and iOS 9 is getting very confused.


Anyone else seeing this?


-Brian

Replies

Hi Brian,
I experience exactly the same behaviour.

Maybe it has something to to with modal presentation? Is your current view controller presented modally when the calibration screen is shown?


-Andi

No, my ViewController is presented as the root viewcontroller for the entiere app.


-Brian

I'm amazed that in iOS 9.2 this still has not been fixed. Pretty major bug that's causing some of our games to become unplayable and the customer blames us even though it just a matter of recalibration which is no longer possible.


-Brian

I'm having the same issue (iOS 9.3.1) - did you find a solution or a workaround?

Also saw similar behaviour with iOS 10. In my case it was because I had CMMotionManager showsDeviceMovementDisplay property set to YES. The framework default is NO. Turning the property to NO only showed the calibration screen once and stopped the flashing. In my application I'm also using CLLocationManager heading updates but it didn't seem to make a difference to the flashing in my case.

When showsDeviceMovementDisplay is set to NO the compass calibration dialog should never come up. It's only when it's YES that it will appear, and when I tested this again last week I found that on the latest iOS 10 it is still malfunctioning. Once in a while it works correctly, but it is very rare. I can't believe Apple hasn't fixed this in 2 years.


-Brian

The Compass Calibration dialog randomly flashes and disappears for me in iOS 11 beta 6. I don't use CMMotionManager but I do use CLLocationManager heading updates which seems to cause the problem.

Yep, it appears Apple has no intent on ever fixing this bug. It's been there for years and they know about it, but like most bugs these days they don't seem to have any interest in doing anything about it.

I had the same issue. I was using CoreMotion device movement updates like so:

[motionManager startDeviceMotionUpdatesUsingReferenceFrame:referenceFrame toQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error)
{
     // do something

}];

The issue was fixed for me by explicitly stopping updates as soon as an error is passed to the handler, like so:

[motionManager startDeviceMotionUpdatesUsingReferenceFrame:referenceFrame toQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error)
{
     if(error)
     {
          [motionManager stopDeviceMotionUpdates];
     }
     else
     {
          // do something
     }
}];


I see a few more updates come through after I call -stopDeviceMotionUpdates (which I ignore).

Apple does actually state that updates should be stopped in error conditions in the CMDeviceMotionHandler documentation.


Hope this helps!

Thanks for the info! The only problem with that solution is that it will completely turn off Core Motion, right? That's not really a fix - it actually would make things worse by completely breaking the game's control system.


-Brian