Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在辅助线程上进行UI更新时,应用程序很少崩溃_Iphone_Ios_Ipad - Fatal编程技术网

Iphone 在辅助线程上进行UI更新时,应用程序很少崩溃

Iphone 在辅助线程上进行UI更新时,应用程序很少崩溃,iphone,ios,ipad,Iphone,Ios,Ipad,这对我来说真的很奇怪,因为我的应用程序在调试模式下工作得很好&当测试人员尝试发布版本时,很少会出现崩溃。我从控制台日志和崩溃日志中了解到,UI正在尝试从辅助线程进行更新,但并不总是这样 在崩溃点,我的控制台日志显示 MyApp[715] <Warning>: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment

这对我来说真的很奇怪,因为我的应用程序在调试模式下工作得很好&当测试人员尝试发布版本时,很少会出现崩溃。我从控制台日志和崩溃日志中了解到,UI正在尝试从辅助线程进行更新,但并不总是这样

在崩溃点,我的控制台日志显示

MyApp[715] <Warning>: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.May 21 10:51:25 
MyApp[715] <Warning>: bool _WebTryThreadLock(bool), 0x1e1dd280: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...May 21 10:51:25 
MyApp[715] <Notice>: 1   0x38b048f7 WebThreadLock

我不是很确定这个修复,因为我还没有复制它在我的结束。如果有人至少能帮我复制,那将是很大的帮助:)

你在后台线程中更改GUI,但根据苹果公司的说法,你在后台线程中没有更改GUI……所以使用
performselectornmainthread
来更改GUI

This may be a result of calling to UIKit from a secondary thread.

在主线程上更新用户界面。在任何情况下,在单独的
线程中执行
UI
更新的原因都将无效。一种选择是,它在后台线程中执行操作,完全不会崩溃。

在主线程中更新GUI是的,dark说的没错,所有与GUI相关的操作都在主线程中执行如果不能解决prblm问题,请提供您的代码问题是从其他线程更新ui不会总是使您的应用程序崩溃。。但有时会感谢你的回复。甚至我也知道UI需要在主线程上更新&一些标准,如performSelectorOnMainThread或主队列上的block get dispatch queue。但为什么它没有给我带来崩溃:)
This may be a result of calling to UIKit from a secondary thread.