From 8e9c44bc3b1f08968d14f485002e7472b689bd67 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 14 Jan 2025 22:35:13 -0800
Subject: [PATCH] Fixed accidental removal of optional delegate interface check
Fixes https://github.com/libsdl-org/SDL/issues/11970
---
src/video/uikit/SDL_uikitwindow.m | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m
index 1bc7936007a2c..2b258b19139b5 100644
--- a/src/video/uikit/SDL_uikitwindow.m
+++ b/src/video/uikit/SDL_uikitwindow.m
@@ -398,7 +398,11 @@ void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int
/* Get all possible valid orientations. If the app delegate doesn't tell
* us, we get the orientations from Info.plist via UIApplication. */
- validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow];
+ if ([app.delegate respondsToSelector:@selector(application:supportedInterfaceOrientationsForWindow:)]) {
+ validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow];
+ } else {
+ validOrientations = [app supportedInterfaceOrientationsForWindow:data.uiwindow];
+ }
if (hint != NULL) {
NSArray *orientations = [@(hint) componentsSeparatedByString:@" "];