码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 13 statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window 错误

时间:2019-11-20 13:05:17      阅读:514      评论:0      收藏:0      [点我收藏+]

标签:shared   rmi   方式   window   hang   uiwindow   this   ffffff   long   

突然的崩溃让我措手不及

*** 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.‘

 

修改方式

  if (@available(iOS 13.0, *)) {

             if (!_statusBar) {

                 // iOS 13  弃用keyWindow属性  从所有windowl数组中取

                 UIWindow *keyWindow = [UIApplication sharedApplication].windows[0];

                 _statusBar = [[UIView alloc] initWithFrame:keyWindow.windowScene.statusBarManager.statusBarFrame];

                 [keyWindow addSubview:_statusBar];

             }

}

iOS 13 statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window 错误

标签:shared   rmi   方式   window   hang   uiwindow   this   ffffff   long   

原文地址:https://www.cnblogs.com/yangqinoak/p/11896798.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!