Skip to content

Commit 57dbd1b

Browse files
Fix deprecated interfaceOrientation on iOS 26
Use effectiveGeometry.interfaceOrientation on iOS 26+ while keeping the old interfaceOrientation call for earlier iOS versions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 11a5d4d commit 57dbd1b

File tree

1 file changed

+10
-3
lines changed
  • Dependencies/xr/Source/ARKit

1 file changed

+10
-3
lines changed

Dependencies/xr/Source/ARKit/XR.mm

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,18 @@ - (void) UnlockAnchors {
259259
- (UIInterfaceOrientation)orientation {
260260
UIApplication* sharedApplication = [UIApplication sharedApplication];
261261
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_13_0)
262-
UIScene* scene = [[[sharedApplication connectedScenes] allObjects] firstObject];
263-
return [(UIWindowScene*)scene interfaceOrientation];
262+
UIWindowScene* windowScene = (UIWindowScene*)[[[sharedApplication connectedScenes] allObjects] firstObject];
263+
if (@available(iOS 26.0, *)) {
264+
return windowScene.effectiveGeometry.interfaceOrientation;
265+
}
266+
return [windowScene interfaceOrientation];
264267
#else
265268
if (@available(iOS 13.0, *)) {
266-
return [[[[sharedApplication windows] firstObject] windowScene] interfaceOrientation];
269+
UIWindowScene* windowScene = [[[sharedApplication windows] firstObject] windowScene];
270+
if (@available(iOS 26.0, *)) {
271+
return windowScene.effectiveGeometry.interfaceOrientation;
272+
}
273+
return [windowScene interfaceOrientation];
267274
}
268275
else {
269276
return [sharedApplication statusBarOrientation];

0 commit comments

Comments
 (0)