Before it worked, when I made the update iOS 13 and updated xCode to 11, I am not able to use the side bar. The application is using the pod SideMenuController and when I click on the icon of side menu to show it, it crashes and shows me this message:
Assertion failure in -[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore/UIKit-3899.22.15/UIApplication.m:5311
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.'
Previous code:
UIApplication.shared.statusBarView?.backgroundColor = UIColor.init(red: 243/250, green: 243/250, blue: 243/250, alpha: 1)
Change to:
I have encountered this issue before. My application got crash while I run this code using XCode 11 and Swift 5.0.:
if #available(iOS 13.0, *) {
let statusBar = UIView(frame: UIApplication.shared.keyWindow?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero)
statusBar.backgroundColor = UIColor.init(red: 243/250, green: 243/250, blue: 243/250, alpha: 1)
UIApplication.shared.keyWindow?.addSubview(statusBar)
} else {
UIApplication.shared.statusBarView?.backgroundColor = UIColor.init(red: 243/250, green: 243/250, blue: 243/250, alpha: 1)
}
I will answer why didn't I show the code, because I didn't made it, the engineer that was before me made it with a pod named SideMenuController. So I'm not familiar with the project or the code inside. I did a lot of research and I fixed it and I wanted to share the solution with you. ( PS: I don't know how it worked ) in the description of the pod, I needed to comment this line:
SideMenuController.preferences.animating.transitionAnimator = FadeAnimator.self
and another line to change from:
SideMenuController.preferences.animating.statusBarBehaviour = .horizontalPan
To this line:
SideMenuController.preferences.animating.statusBarBehaviour = .showUnderlay
And it worked like magic, Thank you guys
Please refer & try:
https://github.com/teodorpatras/SideMenuController/issues/174
merged in a fix for this: https://github.com/cjlarsen/SideMenuController
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.