Dec 10 10:40:10 my-iPhone myAppname[5967] <Warning>: CoreAnimation: warning,deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.
我设置CA_DEBUG_TRANSACTIONS = 1并找到以下列表.
Dec 10 10:43:45 my-iPhone myAppname[5994] <Warning>: CoreAnimation: warning,deleted thread with uncommitted CATransaction; created by: 0 QuartzCore 0x348fc65d <redacted> + 220 1 QuartzCore 0x348fc541 <redacted> + 224 2 QuartzCore 0x348fc325 <redacted> + 24 3 QuartzCore 0x34900489 <redacted> + 44 4 QuartzCore 0x34905091 <redacted> + 456 5 QuartzCore 0x34904ebf <redacted> + 42 6 QuartzCore 0x34904e91 <redacted> + 44 7 myAppname 0x000d9ec1 -[MainVIEwController updateProgress:] + 56 8 Foundation 0x3a75067d <redacted> + 972 9 libsystem_c.dylib 0x397d6311 <redacted> + 308 10 libsystem_c.dylib 0x397d61d8 thread_start + 8
导致此警告的代码如下所示:
- (voID)updateProgress:(Nsstring*) myLabelString { //this is updating a UILabel on the main vIEw [myLabel setText:myLabelString]; }
它是从for循环调用的,我调用performSelectorinBackground:
for (;;) { // Do stuff here to set up the info for the string [self performSelectorInBackground:@selector(updateProgress:) withObject:myLabelString]; usleep(100000); if (stopLoop == YES) { // do stuff before we exit for loop break; }}
我已经尝试了几个主要的想法,确保在退出选择器“updateProgress”之前确保对myLable的更新已完成,唯一的作用是将时间(56)更改为更大的数字.
我也试过用:
[UIVIEw beginAnimations:nil context:NulL]; [UIVIEw setAnimationDuration:1.0f]; // edit UILabel here [UIVIEw commitAnimations];
我从另一篇文章中尝试了这个,但由于我没有使用核心动画,因此编译器反对“CATransaction”作为未声明的标识符并不感到惊讶.
[CATransaction begin]; [CATransaction setdisableActions:YES]; // [CATransaction commit];
有关如何确定标签更新是否完整的任何建议?正如我所说的应用程序正在运行,我只需要清除此警告.
解决方法 这个问题在开发者论坛上得到了解答.事实证明我在后台线程上做UIKit工作.
我换了一行:
[self performSelectorInBackground:@selector(updateProgress:) withObject:myLabelString];
至:
[self performSelectorOnMainThread:@selector(updateProgress:) withObject:myLabelString waitUntilDone:NO];
我尝试将WaitUntilDone设置为YES,这也有效.
总结以上是内存溢出为你收集整理的objective-c – iOS 6:CoreAnimation:警告,已删除的线程与未提交的CATransaction全部内容,希望文章能够帮你解决objective-c – iOS 6:CoreAnimation:警告,已删除的线程与未提交的CATransaction所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)