From 3e54a2cd1b643f822ecf7bd25a558b06065bf1b1 Mon Sep 17 00:00:00 2001 From: Joemer Ramos Date: Thu, 2 Mar 2023 17:19:02 -0500 Subject: [PATCH] ios: Support minimum deployment targets of iOS15 The windows property of UIApplication is unavailable in iOS15. Bug: 1406561 crashpad: Change-Id: I19642067a13801142cd3f24586bab6958a81635d Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4304398 Reviewed-by: Justin Cohen Commit-Queue: Joemer Ramos --- test/ios/host/cptest_application_delegate.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/ios/host/cptest_application_delegate.mm b/test/ios/host/cptest_application_delegate.mm index c2ee1949..8740f6d7 100644 --- a/test/ios/host/cptest_application_delegate.mm +++ b/test/ios/host/cptest_application_delegate.mm @@ -110,13 +110,17 @@ GetProcessSnapshotMinidumpFromSinglePending() { UIWindow* GetAnyWindow() { #if defined(__IPHONE_15_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0 + UIWindowScene* scene = reinterpret_cast( + [UIApplication sharedApplication].connectedScenes.anyObject); if (@available(iOS 15.0, *)) { - UIWindowScene* scene = reinterpret_cast( - [UIApplication sharedApplication].connectedScenes.anyObject); return scene.keyWindow; + } else { + return [scene.windows firstObject]; } -#endif + +#else return [UIApplication sharedApplication].windows[0]; +#endif } [[clang::optnone]] void recurse(int counter) {