注册:修改正在最终确定的层....... [CALayer frame]:消息发送到释放的实例0xe43c520 [英] Reg: modifying layer that is being finalized....... [CALayer frame]: message sent to deallocated instance 0xe43c520

查看:317
本文介绍了注册:修改正在最终确定的层....... [CALayer frame]:消息发送到释放的实例0xe43c520的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个非常奇怪的问题。我希望你们中的很多人能提供我的解决方案。

I am stuck with a very strange issue. I hope that many of you can provide me input to solve this. My application breaks quite often, but I am not able to get the exact scenario.

在日志中,我得到以下结果:

In Log I get following

2011-02-10 16:22:12.914 RCA-iOS[4132:8327] modifying layer that is being finalized - 0xe43c520
2011-02-10 16:22:13.253 RCA-iOS[4132:207] modifying layer that is being finalized - 0xe43c520
2011-02-10 16:22:13.270 RCA-iOS[4132:207] modifying layer that is being finalized - 0xe43c520
2011-02-10 16:22:13.270 RCA-iOS[4132:207] modifying layer that is being finalized - 0xe43c520
2011-02-10 16:22:13.272 RCA-iOS[4132:207] *** -[CALayer frame]: message sent to deallocated instance 0xe43c520

堆栈跟踪。它在主线程中断线

Following is my Stack Trace. It breaks in main thread

#0  0x01978057 in ___forwarding___
#1  0x01a07b42 in __forwarding_prep_1___
#2  0x003c196a in -[UIView(Geometry) frame]
#3  0x003f5ff4 in -[UINavigationBar _getTitleViewFrame:leftViewFrame:rightViewFrame:forViews:forItemAtIndex:]
#4  0x003e5cab in -[UINavigationBar _getTitleViewFrame:leftViewFrame:rightViewFrame:forViews:]
#5  0x003f0c06 in __-[UINavigationBar layoutSubviews]_block_invoke_1
#6  0x003bdb5c in +[UIView(Animation) _performWithoutAnimation:]
#7  0x003f76bb in -[UINavigationBar layoutSubviews]
#8  0x00f59451 in -[CALayer layoutSublayers]
#9  0x00f5917c in CALayerLayoutIfNeeded
#10 0x00f5237c in CA::Context::commit_transaction
#11 0x00f520d0 in CA::Transaction::commit
#12 0x00f827d5 in CA::Transaction::observer_callback
#13 0x019e7fbb in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
#14 0x0197d0e7 in __CFRunLoopDoObservers
#15 0x01945bd7 in __CFRunLoopRun
#16 0x01945240 in CFRunLoopRunSpecific
#17 0x01945161 in CFRunLoopRunInMode
#18 0x02129268 in GSEventRunModal
#19 0x0212932d in GSEventRun
#20 0x0039e42e in UIApplicationMain
#21 0x00001fd0 in main at main.m:14

以下是Instrument的NSZombie对象的输出。这指向UIKit

And Following is the Instrument`s output for NSZombie object. This points to UIKit

#   Category    Event Type  RefCt   Timestamp   Address Size    Responsible Library Responsible Caller
0   CALayer Malloc  1   25304068864 0x10837840  48  UIKit   -[UIView _createLayerWithFrame:]
1   CALayer Zombie  -1  99780847872 0x10837840  0   UIKit   -[UIView(Geometry) frame]

没有指向代码。有没有人面临这种​​问题?如果是的,请让我知道以下这些_

1)当我们得到正在完成修改层的问题?

2)是否由于UIView的图层?例如(view.layer.cornerRadius)?

3)堆栈跟踪指向UINAvigationBar,是否有任何方法覆盖方法并试试一些事情?

$ b $bÁ
任何帮助。感谢

Nothing point to the code. Has any one faced this kind of issue? If yes please let me know following
1) When we get "Modifying layer that is being finalized" breaking issue?
2) Is is due to layer of UIView? For example (view.layer.cornerRadius) ?
3) Stack Trace points to UINAvigationBar, is there any way to override the methods and tryout some thing?

Any help is appreciated. Thanks

推荐答案

出现错误正在完成修改图层当您尝试修改CALayer的属性时,它正在被释放的过程中。当我在层中的 -dealloc 方法中意外地使用访问器来清除CALayer上的属性时,我发现了这种情况。

The error "modifying layer that is being finalized" occurs when you are trying to modify the properties of a CALayer when it is in the process of being deallocated. I've seen this happen when I've accidentally used an accessor to clear a property on a CALayer while within that layer's -dealloc method.

如果任何显示相关的更新(因此触摸底层的CALayer),这也可能发生在UIView的 -dealloc 方法中。

This may also happen within a UIView's -dealloc method if anything display-related is updated (thus touching the underlying CALayer).

在你的情况下,它看起来像你在某处过度释放一个UIView,由于僵尸的消息。 正在完成的修改层只是一个副作用,因为在某些时候,你将更新UIView,而它被解除分配之前它应该。

In your case, it looks like you're overreleasing a UIView somewhere, due to the zombie message. The "modifying layer that is being finalized" is just a side-effect of that, because at some point you'd be updating the UIView while it's being deallocated before it should.

打开断点,确保您对抛出的异常设置了断点,并在调试器中运行应用程序。它应该停止在消息被发送到过多的UIView的行,应该告诉你什么视图是这个的中心。然后你可以回溯找到你发送一个太多的发布消息(或如果你需要它超出当前范围,自动释放而不保留)。

Turn on breakpoints, make sure you've set a breakpoint on exceptions being thrown, and run your application within the debugger. It should halt on the line where a message is being sent to an overreleased UIView, which should tell you what view is at the center of this. Then you can backtrack to find at what point you're sending one too many release messages (or have autoreleased without retaining if you need it beyond the current scope).

因为你已经有证据指向UINavigationBar,检查它及其相关联的视图,以确保你正确保留它。

Because you already have evidence pointing to the UINavigationBar, check it and its associated views to make sure that you're properly retaining it.

这篇关于注册:修改正在最终确定的层....... [CALayer frame]:消息发送到释放的实例0xe43c520的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆