CoreAnimation uncommitted CATransaction warning

帅比萌擦擦* 提交于 2019-12-24 10:28:53

问题


On Mac OS 10.8 I'm getting the following warning in my app:

CoreAnimation: warning, deleted thread with uncommitted CATransaction;

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?


回答1:


I found that wrapping the offending code an explicit CATransaction with actions disabled made the warning go away.

i.e.

[CATransaction begin];
[CATransaction setDisableActions:YES];
layer.bounds = CGRectMake(0, 0, 1000, 1000);
[CATransaction commit];


来源:https://stackoverflow.com/questions/11882931/coreanimation-uncommitted-catransaction-warning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!