Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行直接崩溃 #46

Open
QiaoLansheng opened this issue Jun 15, 2020 · 3 comments
Open

运行直接崩溃 #46

QiaoLansheng opened this issue Jun 15, 2020 · 3 comments

Comments

@QiaoLansheng
Copy link

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
Copy link

cnzlh commented Jul 3, 2020

- (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
Copy link

setStatusBarBackgroundColor 崩溃了= =。。 看了上边代码大概知道问题了= =。。求github上版本更新下

@AlureLove
Copy link

在BaseViewController中得 setStatusBarBackgroundColor ,将里面的代码注释了即可,原因是iOS13以后,系统会自动调用status bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants