我在 App Store 上的应用程序崩溃了。
以下是我在崩溃日志中的内容。
我的项目中有基本视图控制器。我正在使用基本视图控制器扩展每个视图控制器。
在基本视图控制器中,在 viewDidAppear 中,我使用以下代码设置状态栏颜色。
static func adjustStatusBarToColor(colorAsString: String) {
print("adjustStatusBarToColor===\(globalTopPadding)")
if (globalTopPadding>=1) {
if let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as? UIView {
let statusBar2: UIView = statusBar.subviews[0]
let setForegroundColor_sel: Selector = NSSelectorFromString("setForegroundColor:")
statusBar2.perform(setForegroundColor_sel, with: UIColor(hexString: colorAsString))
}
} else {
if let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as? UIView {
let setForegroundColor_sel: Selector = NSSelectorFromString("setForegroundColor:")
statusBar.perform(setForegroundColor_sel, with: UIColor(hexString: colorAsString))
}
}
}
知道为什么应用程序崩溃了吗?