I'm trying to build my app with Xcode 11 beta 6 and iOS 13 beta 8 but it throws this error once it starts to run:
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.'
What is the window scene and how do I use the statusBarManager
?
And I'm not sure if this is relevant, but I'm not using any SwiftUI
.
The centralized point of control and coordination for apps running in iOS. Every iOS app has exactly one instance of UIApplication (or, very rarely, a subclass of UIApplication ). When an app launches, the system calls the UIApplicationMain (_:_:_:_:) function.
Every iOS app has exactly one instance of UIApplication (or, very rarely, a subclass of UIApplication). When an app is launched, the system calls the UIApplicationMain(_:_:_:_:) function; among its other tasks, this function creates a Singleton UIApplication object. Thereafter you access the object by calling the shared class method.
When an app launches, the system calls the UIApplicationMain (_:_:_:_:) function. Among its other tasks, this function creates a singleton UIApplication object that you access using shared. Your app’s application object handles the initial routing of incoming user events.
Every iOS app has exactly one instance of UIApplication (or, very rarely, a subclass of UIApplication ). When an app launches, the system calls the UIApplicationMain (_:_:_:_:) function. Among its other tasks, this function creates a singleton UIApplication object that you access using shared.
You need to add the following extension to access statusbarview :
extension UIApplication {
var statusBarUIView: UIView? {
if #available(iOS 13.0, *) {
let tag = 38482458385
if let statusBar = self.keyWindow?.viewWithTag(tag) {
return statusBar
} else {
let statusBarView = UIView(frame: UIApplication.shared.statusBarFrame)
statusBarView.tag = tag
self.keyWindow?.addSubview(statusBarView)
return statusBarView
}
} else {
if responds(to: Selector(("statusBar"))) {
return value(forKey: "statusBar") as? UIView
}
}
return nil
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With