【发布时间】:2011-10-31 17:40:02
【问题描述】:
使用 ARC(自动引用计数),我在子类 UITableViewCell 中有一个 UIButton。表视图控制器实现了与UIButton 挂钩的IBAction。在子类单元格的 xib 中,同一个表视图控制器是文件的所有者。
当我运行应用程序并单击按钮时出现问题,我得到一个EXC_BAD_ACCESS。它在 iPhone 屏幕上清晰可见,因此它在某个时候被分配。
知道问题可能是什么吗?提前致谢!
编辑1:
注意:我将环境变量 NSZombieEnabled 设置为 true。
这是控制台:
2011-10-31 22:22:08.653 MyApp[7176:fb03] *** -[NSObject performSelector:withObject:withObject:]: message sent to deallocated instance 0x6b94d40
(lldb) thread backtrace
* thread #1: tid = 0x1f03, 0x014c3e1e CoreFoundation`___forwarding___ + 206, stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x014c3e1e CoreFoundation`___forwarding___ + 206
frame #1: 0x014c3ce2 CoreFoundation`_CF_forwarding_prep_0 + 50
frame #2: 0x001e45c2 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 96
frame #3: 0x001e455a UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
frame #4: 0x00289b76 UIKit`-[UIControl sendAction:to:forEvent:] + 66
frame #5: 0x0028a03f UIKit`-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
frame #6: 0x002892fe UIKit`-[UIControl touchesEnded:withEvent:] + 549
frame #7: 0x004a2a2a UIKit`_UIGestureRecognizerUpdate + 6725
frame #8: 0x015319ce CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #9: 0x014c8670 CoreFoundation`__CFRunLoopDoObservers + 384
frame #10: 0x014944f6 CoreFoundation`__CFRunLoopRun + 1174
frame #11: 0x01493db4 CoreFoundation`CFRunLoopRunSpecific + 212
frame #12: 0x01493ccb CoreFoundation`CFRunLoopRunInMode + 123
frame #13: 0x02449879 GraphicsServices`GSEventRunModal + 207
frame #14: 0x0244993e GraphicsServices`GSEventRun + 114
frame #15: 0x001e1a9b UIKit`UIApplicationMain + 1175
frame #16: 0x0000278d MyApp`main + 125 at main.m:14
frame #17: 0x00001ff5 MyApp`start + 53
【问题讨论】:
-
你认为它为什么被释放了?这不是获得 EXC_BAD_ACCESS 的唯一原因。向我们展示堆栈跟踪。
标签: ios cocoa-touch uitableview uibutton