gpt4 book ai didi

ios - 线程 1 : signal SIGABRT error running on Xcode 11. 2.1

转载 作者:行者123 更新时间:2023-11-28 20:49:36 26 4
gpt4 key购买 nike

项目(react-native)在 ​​Xcode 10.2 上运行良好,为了在 iOS 13 上测试它,我尝试用 Xcode 11.2.1 打开项目,应用程序在启动时崩溃,Xcode 11.2.1 出现错误控制台如下:

Assertion failure in -[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3900.12.16/UIApplication.m:5316
2019-12-10 14:26:37.206842+0530 workish[73259:574909] *** 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.'
*** First throw call stack:

最佳答案

您正在尝试访问自 iOS 13 以来已弃用的代码中某处的 statusBar。以下是获取 iOS 13+ 及以下版本的 statusBar 的示例代码

  if #available(iOS 13.0, *) {
let statusBarFrame = UIView(frame: UIApplication.shared.keyWindow?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero)
statusBarFrame.backgroundColor = UIColor.init(red: 243/250, green: 243/250, blue: 243/250, alpha: 1)
UIApplication.shared.keyWindow?.addSubview(statusBarFrame)
} else {
UIApplication.shared.statusBarView?.backgroundColor = UIColor.init(red: 243/250, green: 243/250, blue: 243/250, alpha: 1)
}

关于ios - 线程 1 : signal SIGABRT error running on Xcode 11. 2.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59263516/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com