iOS11MBProgressHUD无法显示弹窗

来源:互联网 发布:武汉理工网络教学平台 编辑:程序博客网 时间:2024/06/01 09:57
if (view == nil) view = [[UIApplication sharedApplication].windows lastObject];

改为

if (view == nil) view = [UIApplication sharedApplication].keyWindow;


keyWindow Discussion
The value of this property is YES when the window is the key window or NO when it is not. The key window receives keyboard and other non-touch related events. Only one window at a time may be the key window.

windows Discussion
This property contains the UIWindow objects currently associated with the app. This list does not include windows created and managed by the system, such as the window used to display the status bar.
The windows in the array are ordered from back to front by window level; thus, the last window in the array is on top of all other app windows.

我分别打印iOS11和iOS10的windows集合都不同,所以以后谨慎使用[[UIApplication sharedApplication].windows lastObject];