Jasonette / JASONETTE-iOS

📡 Native App over HTTP, on iOS
https://www.jasonette.com
MIT License
5.27k stars 352 forks source link

NSInternalInconsistencyException with iOS13 #366

Closed tseiffert closed 4 years ago

tseiffert commented 4 years ago

Exception occurs while loading the App in iOS13: '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.'

My current solution was to replace the code in (void)setStatusBarBackgroundColor:(UIColor *)color {

if (@available(iOS 13, *))
{
    UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame] ;
    statusBar.backgroundColor = [UIColor redColor];
    [[UIApplication sharedApplication].keyWindow addSubview:statusBar];
    if ([statusBar respondsToSelector:@selector(setBackgroundColor:)])
    {
        statusBar.backgroundColor = color;
     }
}
else
{
     UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
    if ([statusBar respondsToSelector:@selector(setBackgroundColor:)])
    {
        statusBar.backgroundColor = color;
    }
}

The Swift Version is rather old and I am novice, but at least it is starting up now.

clsource commented 4 years ago

Hello, thanks for your contribution. This issue was already solved in the development branch at https://github.com/jasonelle/jasonette-ios

:)