iOS: fix in some case application delegate's window is nil
This commit is contained in:
parent
1a3789fc4c
commit
9cb4764bfd
@ -126,7 +126,12 @@ void ShowToastInVC(UIViewController *_Nonnull vc, NSString *_Nonnull text, Doric
|
||||
|
||||
BOOL hasNotch() {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
CGFloat height = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom;
|
||||
CGFloat height;
|
||||
if ([[UIApplication sharedApplication] delegate].window) {
|
||||
height = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom;
|
||||
} else {
|
||||
height = [UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom;
|
||||
}
|
||||
return (height > 0);
|
||||
} else {
|
||||
return NO;
|
||||
|
Reference in New Issue
Block a user