Commit 90e87667 authored by hanling's avatar hanling

当 UIApplicationDelegate 没有实现 window 是会闪退

parent 863bcade
......@@ -432,7 +432,13 @@
[_progressHUD addSubview:_HUDContainer];
}
[_HUDIndicatorView startAnimating];
[[UIApplication sharedApplication].delegate.window addSubview:_progressHUD];
UIWindow *applicationWindow;
if ([[[UIApplication sharedApplication] delegate] respondsToSelector:@selector(window)]) {
applicationWindow = [[[UIApplication sharedApplication] delegate] window];
} else {
applicationWindow = [[UIApplication sharedApplication] keyWindow];
}
[applicationWindow addSubview:_progressHUD];
[self.view setNeedsLayout];
// if over time, dismiss HUD automatic
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment