Unverified Commit c75f1c73 authored by 谭真's avatar 谭真 Committed by GitHub

Merge pull request #972 from hanl001/master

UIApplicationDelegate的window是optional的,因此加了一层判断,防止未实现window时的crash
parents 2df58334 90e87667
......@@ -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