运行直接崩溃
QiaoLansheng opened this issue · 3 comments
QiaoLansheng commented
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window. Use the statusBarManager object on the window scene instead.'
cnzlh commented
- (UIView *)statusBarUIview{
if(@available(iOS 13,*)){
int tag = 13004352;
UIWindow *window = [UIApplication sharedApplication].delegate.window;
UIView *view = [window viewWithTag:tag];
if (view) {
return view;
}else{
CGRect statusBarRect = [UIApplication sharedApplication].statusBarFrame;
UIView *statusBarView = [[UIView alloc]initWithFrame:statusBarRect];
statusBarView.tag = tag;
[window addSubview:statusBarView];
return statusBarView;
}
}else{
UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
return statusBar;
}
}
return nil;
}
liubang0909 commented
setStatusBarBackgroundColor 崩溃了= =。。 看了上边代码大概知道问题了= =。。求github上版本更新下
AlureLove commented
在BaseViewController中得 setStatusBarBackgroundColor ,将里面的代码注释了即可,原因是iOS13以后,系统会自动调用status bar