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) {