gpt4 book ai didi

objective-c - 主线程检查器 : UI API called on a background thread iOS 11 Xcode 9 GM Seed

转载 作者:行者123 更新时间:2023-12-01 13:28:58 25 4
gpt4 key购买 nike

任何人都可以帮我调试这个问题,从我开始使用 Xcode 9 GM 种子和 iOS 11 GM 种子开始,我的代码在控制台中向我发出警告:

2017-09-18 16:22:52.872716+0530 **** *****[359:20158] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication 
applicationState] .PID: 359, TID: 20158,
Thread name: Runtime Network Callback Thread,
Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:

另外,我在应用程序中使用 ESRI map ,当我放大或缩小 ESRI map 时,我会收到此错误:

  2017-09-18 16:22:53.176524+0530 *** ***[359:20063] Task <5F9376DB-9335-
4A45-B3F0-1D6FD69A19A3>.<29> finished with error - code: -999
2017-09-18 16:22:53.178923+0530 *** ***[359:20142] Task <0DE282EA-3FBD-
4036-8298-C75EFA65F15A>.<40> HTTP load failed (error code: -999 [1:89])
2017-09-18 16:22:53.179821+0530 *** *[359:20063] Task <BE2D8BAE-FFB8-
43CA-8723-111326DEF4FD>.<31> finished with error - code: -999
2017-09-18 16:22:53.180089+0530 *** ***[359:20063] Task <E7C819D4-C11A-
4915-B021-A73F31BE89CD>.<33> finished with error - code: -999
2017-09-18 16:22:53.180365+0530 *** ***[359:20063] Task <3B871761-B006-
4220-B857-6204B385AD34>.<34> finished with error - code: -999
2017-09-18 16:22:53.180523+0530 *** ***[359:20142] Failed to get
TCPIOConnection in addInputHandler.

应用程序在 Xcode 8 iOS 10.3.3 上运行良好。问题似乎出在 Xcode 9 上。任何人都可以帮我调试这个问题吗?谢谢

最佳答案

Xcode 9 添加了新的运行时检查,即 Main Thread Checker .

根据苹果文档:

The Main Thread Checker is a standalone tool for Swift and C languages that detects invalid usage of AppKit, UIKit, and other APIs on a background thread. Updating UI on a thread other than the main thread is a common mistake that can result in missed UI updates, visual defects, data corruptions, and crashes.

您在使用 Xcode 8 的应用程序中已经遇到此问题。只是还没有检测该问题的工具。

就您而言,似乎是对 UIApplication.shared.applicationState 的调用导致了此运行时问题。

您可以将应用方案配置为在发生这种情况时停止执行。它是“诊断”选项卡中“主线程检查器”部分下的一个复选框。

关于objective-c - 主线程检查器 : UI API called on a background thread iOS 11 Xcode 9 GM Seed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46278957/

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