UIApplication委托只能从主线程使用 - Swift

问题描述 投票:-3回答:1

我得到“运行时:从后台线程调用UI API: - [UIApplication委托]必须仅从主线程使用”Fabric初始化行的运行时问题。不知道如何解决它。请帮忙

谢谢

Fabric.with([Crashlytics.self,Zendesk.self])

Issue Image

ios swift google-fabric
1个回答
1
投票

这是因为您尝试从后台线程访问UI。只需在主线程中调用UI更改即可。

DispatchQueue.main.async {
   application.statusBarStyle = UIStatusBarStyle.lightContent
}

UI进程在主线程下维护。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.