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 <justincohen@chromium.org>
Commit-Queue: Joemer Ramos <joemerramos@chromium.org>
This commit is contained in:
Joemer Ramos 2023-03-02 17:19:02 -05:00 committed by Crashpad LUCI CQ
parent 707d0d4dac
commit 3e54a2cd1b

View File

@ -110,13 +110,17 @@ GetProcessSnapshotMinidumpFromSinglePending() {
UIWindow* GetAnyWindow() { UIWindow* GetAnyWindow() {
#if defined(__IPHONE_15_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0 #if defined(__IPHONE_15_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0
UIWindowScene* scene = reinterpret_cast<UIWindowScene*>(
[UIApplication sharedApplication].connectedScenes.anyObject);
if (@available(iOS 15.0, *)) { if (@available(iOS 15.0, *)) {
UIWindowScene* scene = reinterpret_cast<UIWindowScene*>(
[UIApplication sharedApplication].connectedScenes.anyObject);
return scene.keyWindow; return scene.keyWindow;
} else {
return [scene.windows firstObject];
} }
#endif
#else
return [UIApplication sharedApplication].windows[0]; return [UIApplication sharedApplication].windows[0];
#endif
} }
[[clang::optnone]] void recurse(int counter) { [[clang::optnone]] void recurse(int counter) {