发生了什么?
我在程序中遇到异常,在该程序中,要在 UItableViewCell
的 contentView
内的自定义 View 上点击按钮,调用函数
我尝试了什么?
1) 我试图在 Breakpoints Navigator
2) 从Instruments
检查僵尸检测3)应该调用的函数中的断点
我收到的崩溃日志?
-[UIImageView nextPage:]: unrecognized selector sent to instance 0xa7d5f20
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView nextPage:]: unrecognized selector sent to instance 0xa7d5f20'
*** First throw call stack:
(
0 CoreFoundation 0x023e11e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01fc98e5 objc_exception_throw + 44
2 CoreFoundation 0x0247e243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x023d150b ___forwarding___ + 1019
4 CoreFoundation 0x023d10ee _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x01fdb880 -[NSObject performSelector:withObject:withObject:] + 77
6 UIKit 0x009463b9 -[UIApplication sendAction:to:from:forEvent:] + 108
7 UIKit 0x00946345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
8 UIKit 0x00a47bd1 -[UIControl sendAction:to:forEvent:] + 66
9 UIKit 0x00a47fc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
10 UIKit 0x00a47243 -[UIControl touchesEnded:withEvent:] + 641
11 UIKit 0x00cdc2e3 _UIGestureRecognizerUpdate + 7166
12 UIKit 0x00985a5a -[UIWindow _sendGesturesForEvent:] + 1291
13 UIKit 0x00986971 -[UIWindow sendEvent:] + 1021
14 UIKit 0x009585f2 -[UIApplication sendEvent:] + 242
15 UIKit 0x00942353 _UIApplicationHandleEventQueue + 11455
16 CoreFoundation 0x0236a77f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
17 CoreFoundation 0x0236a10b __CFRunLoopDoSources0 + 235
18 CoreFoundation 0x023871ae __CFRunLoopRun + 910
19 CoreFoundation 0x023869d3 CFRunLoopRunSpecific + 467
20 CoreFoundation 0x023867eb CFRunLoopRunInMode + 123
21 GraphicsServices 0x0381a5ee GSEventRunModal + 192
22 GraphicsServices 0x0381a42b GSEventRun + 104
23 UIKit 0x00944f9b UIApplicationMain + 1225
24 IslamBox 0x000029bc main + 76
25 libdyld.dylib 0x034b3701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
What else could i do as the functions are registered in the Nib file?
更新:正如日志所说 -[UIImageView nextpage] 无法识别,但下一页位于 ViewController 中。因为自定义 View 是添加到单元格 contentView 的 ViewController View 。
最佳答案
我需要保留我的 ViewController ,或者如果使用 ARC,则保留对它的强引用。如果我将它作为局部变量分配给 cell.contentView,那么当 nextPage:
被调用时,它就不再存在了。 (该错误表明其内存已被释放并重新用于不同类型的对象。)
关于iOS - 无法定位异常的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24548436/