更新时间:2022-12-09 10:47:54
我不知道您的代码是什么,但是我对为什么会这样有一个想法.您必须在后台线程中进行一些UI更改.
I don't know what your code is, but I have an idea as to why this is happening. You must be having some UI changes done in a background thread.
请勿从主线程以外的任何内容更改UI,它必须绑定到 使您的应用程序不稳定,并意外崩溃.
Do not change UI from anything but the main thread, it is bound to make your application unstable, and crash unpredictably.
您可以从任何线程侦听和执行工作,并将UI更改封装在dispatch_async中:
You can listen and do work from any thread, and encapsulate UI changes in a dispatch_async:
dispatch_async(dispatch_get_main_queue(), ^{
// Do UI stuff here
});