fix(ios): use window scene interface orientation for heading compensation (#4548)

This commit is contained in:
VandenOstende
2026-09-06 03:04:02 +02:00
committed by GitHub
parent eca9e1db33
commit a33d3f00fb
2 changed files with 12 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ MapLibre welcomes participation and contributions from everyone. Please read [`M
- core: rename `mbgl` directories to `mln` ([#4511]((https://github.com/maplibre/maplibre-native/pull/4511))).
- Fix surface transform ([#4495](https://github.com/maplibre/maplibre-native/pull/4495)).
- fix(core): Fix nullptr access during custom layer pre-render ([#4496](https://github.com/maplibre/maplibre-native/pull/4496)).
- fix(ios): use the window scene's interface orientation for heading compensation, replacing the deprecated `-[UIApplication statusBarOrientation]`.
## 6.28.0

View File

@@ -6573,7 +6573,17 @@ static void *windowScreenContext = &windowScreenContext;
// note that right/left device and interface orientations are opposites (see UIApplication.h)
//
CLDeviceOrientation orientation;
switch ([[UIApplication sharedApplication] statusBarOrientation]) {
// -[UIApplication statusBarOrientation] is deprecated and is a no-op as of
// iOS 27, so it can no longer be used to compensate the heading. It is also
// called on every heading update, which makes UIKit log a deprecation notice
// several times per second.
UIInterfaceOrientation interfaceOrientation;
if (@available(iOS 13.0, *)) {
interfaceOrientation = self.window.windowScene.interfaceOrientation;
} else {
interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
}
switch (interfaceOrientation) {
case (UIInterfaceOrientationLandscapeLeft): {
orientation = CLDeviceOrientationLandscapeRight;
break;