headingOrientation processes upside-down orientation wrong!?

I've noticed that since iOS 11, when setting the headingOrientation property of the Location Manager to CLDeviceOrientationPortraitUpsideDown the location manager returns wrong heading values. When the device is facing north the location manager returns south as the heading in this case. Up to and including iOS 10, this works correct and as expected. Since iOS 11 I do get wrong values.


A workaround would be to set the value for headingOrientation to CLDeviceOrientationPortrait when the device is in upside-down orientation, but of course only under iOS 11. iOS 12 seems to have the same issue.


Is this is new policy of the iOS, which I have missed, or is this a bug?

Replies

Looks like portrait upside down is progressively oblsoleted (because of notched iPhones).


Maybe you need to override supportedInterfaceOrientations :


    override open var supportedInterfaceOrientations : UIInterfaceOrientationMask     { 
        return .all 
    }



See this other thread : h ttps://forums.developer.apple.com/message/314009#314009

If this would be on the iPhone X only, I would not say anything. But this happens on all devices, including iPads. And on iPads all four device orientations should be equally important and supported.


The supported User Interface orientations should be irrelevant here, though of course my App does already support all orientations. This is not a User Interface issue, it's a problem of the location manager and its compass.


As a workaround, I currently check the iOS release - for iOS 10 and older I set the headingOrientation property to the correct values, if it is iOS 11 (and maybe 12) I change the CLDeviceOrientationPortraitUpsideDown to CLDeviceOrientationPortrait before I pass this to the headingOrientation property. Then I get the "correct" results from the location mangager. But because this looks like a bug I would like to know if this is really a bug or same strange intended behavior change within the iOS I'm not aware of. If this is a bug, Apple might fix this and then the App would again fail to work, like it did when switching from iOS 10 to iOS 11.

In your case, I would file a bug.