本文介绍了CoreAnimation未提交的CATransaction警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Mac OS 10.8上,我的应用程序收到以下警告:
On Mac OS 10.8 I'm getting the following warning in my app:
CoreAnimation: warning, deleted thread with uncommitted CATransaction;
CoreAnimation: warning, deleted thread with uncommitted CATransaction;
这建议我在环境中打开CA_DEBUG_TRANSACTIONS = 1来记录回溯.
It suggests turning on CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces, which I did.
这是我的追踪记录的顶部
This is the top of my backtrace:
0 QuartzCore 0x00007fff88a84b95 _ZN2CA11Transaction4pushEv + 219
1 QuartzCore 0x00007fff88a8476d _ZN2CA11Transaction15ensure_implicitEv + 273
2 QuartzCore 0x00007fff88a8bb6a _ZN2CA5Layer12begin_changeEPNS_11TransactionEjRP11objc_object + 44
3 QuartzCore 0x00007fff88a8cb4e _ZN2CA5Layer10set_boundsERKNS_4RectEb + 452
4 QuartzCore 0x00007fff88a8c908 -[CALayer setBounds:] + 189
有人知道这个警告是什么,以及如何避免它?
Does anyone know what this warning is, and how to avoid it?
推荐答案
我发现将有问题的代码包装为显式的CATransaction
并禁用了操作,该警告就消失了.
I found that wrapping the offending code an explicit CATransaction
with actions disabled made the warning go away.
即
[CATransaction begin];
[CATransaction setDisableActions:YES];
layer.bounds = CGRectMake(0, 0, 1000, 1000);
[CATransaction commit];
这篇关于CoreAnimation未提交的CATransaction警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!