gpt4 book ai didi

iphone - Reg : modifying layer that is being finalized. ...... [CALayer frame]: 发送到释放实例 0xe43c520 的消息

转载 作者:技术小花猫 更新时间:2023-10-29 10:29:50 25 4
gpt4 key购买 nike

我遇到了一个非常奇怪的问题。我希望你们中的许多人能为我提供解决这个问题的意见。我的应用程序经常中断,但我无法获得确切的场景。

在日志中我得到关注

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

以下是我的堆栈跟踪。它在主线程中中断

#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

以下是 NSZombie 对象的 Instrument 输出。这指向 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) Stack Trace 指向 UINAvigationBar,有什么方法可以覆盖方法并尝试一些东西吗?

任何帮助表示赞赏。谢谢

最佳答案

错误 “修改正在完成的层” 当您尝试修改正在释放的 CALayer 的属性时发生。当我在该层的 -dealloc 方法中不小心使用访问器清除 CALayer 上的属性时,我已经看到了这种情况。

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

在您的情况下,由于僵尸消息,您似乎在某处过度释放了 UIView。 “正在完成的修改层” 只是它的一个副作用,因为在某些时候你会在 UIView 被释放之前更新它。

打开断点,确保您已在抛出异常时设置断点,并在调试器中运行您的应用程序。它应该在将消息发送到过度释放的 UIView 的那一行停止,它应该告诉您哪个 View 位于其中心。然后您可以回溯以找到您在什么时候发送了过多的发布消息(或者如果您需要它超出当前范围则自动发布而不保留)。

因为您已经有指向 UINavigationBar 的证据,请检查它及其关联的 View 以确保您正确地保留了它。

关于iphone - Reg : modifying layer that is being finalized. ...... [CALayer frame]: 发送到释放实例 0xe43c520 的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4956413/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com