我的应用程序有一个 UIScrollView,上面有一些项目(例如 UITextField),并且在大多数情况下,当视图加载此滚动视图时,我可以通过捏合来放大和缩小,并且工作正常。
但是,有时我在控制台中放大和缩小时会收到一些消息,如下所示:
CALayerGetSuperlayer called on instance of __NSArrayM
CALayerGetSuperlayer called on instance of NSShadow
CALayerGetSuperlayer called on instance of __NSCFString
CALayerGetSuperlayer called on instance of __NSCFType
CALayerGetSuperlayer called on instance of UIButtonContent
其他时候我遇到的崩溃总是如下所示:
* thread #1: tid = 0x2503, 0x3b8155b6 libobjc.A.dylib`objc_msgSend + 22, stop reason = EXC_BAD_ACCESS (code=1, address=0x4)
frame #0: 0x3b8155b6 libobjc.A.dylib`objc_msgSend + 22
frame #1: 0x3552e9d4 QuartzCore`CALayerGetSuperlayer + 92
frame #2: 0x357c0e5e UIKit`-[UIView(Hierarchy) containsView:] + 34
frame #3: 0x358eb3d4 UIKit`-[UITextSelectionView affectedByScrollerNotification:] + 140
frame #4: 0x35a5b394 UIKit`-[UITextSelectionView scaleWillChange:] + 24
frame #5: 0x338c7036 CoreFoundation`_CFXNotificationPost + 1426
frame #6: 0x341dd598 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 72
frame #7: 0x341e105a Foundation`-[NSNotificationCenter postNotificationName:object:] + 30
frame #8: 0x35910bea UIKit`-[UIScrollView _updatePinchGestureForState:] + 946
frame #9: 0x3589bd88 UIKit`_UIGestureRecognizerSendActions + 128
frame #10: 0x358633f4 UIKit`-[UIGestureRecognizer _updateGestureWithEvent:] + 392
frame #11: 0x35a50a38 UIKit`___UIGestureRecognizerUpdate_block_invoke_0543 + 48
frame #12: 0x3578782e UIKit`_UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 218
frame #13: 0x35786292 UIKit`_UIGestureRecognizerUpdate + 1274
frame #14: 0x357911e6 UIKit`-[UIWindow _sendGesturesForEvent:] + 766
frame #15: 0x35790db2 UIKit`-[UIWindow sendEvent:] + 90
frame #16: 0x3577e800 UIKit`-[UIApplication sendEvent:] + 380
frame #17: 0x3577e11a UIKit`_UIApplicationHandleEvent + 6154
frame #18: 0x374725a2 GraphicsServices`_PurpleEventCallback + 590
frame #19: 0x374721d2 GraphicsServices`PurpleEventCallback + 34
frame #20: 0x3394b172 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame #21: 0x3394b116 CoreFoundation`__CFRunLoopDoSource1 + 138
frame #22: 0x33949f98 CoreFoundation`__CFRunLoopRun + 1384
frame #23: 0x338bcebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #24: 0x338bcd48 CoreFoundation`CFRunLoopRunInMode + 104
frame #25: 0x374712ea GraphicsServices`GSEventRunModal + 74
frame #26: 0x357d2300 UIKit`UIApplicationMain + 1120
frame #27: 0x000134a4 MyApp`main(argc=3, argv=0x2fdefc68) + 48 at main.m:14
frame #28: 0x00013470 MyApp`start + 40
我的应用程序使用 ARC,并且我尝试在打开僵尸的情况下运行,在这种情况下,应用程序会崩溃并且 Instruments 没有显示任何问题。
关于可能发生什么或如何解决这个问题的任何想法?
编辑:根据史蒂夫的建议,我在打开僵尸的情况下重新检查了它,结果证明,我第一次做的事情一定是错误的。现在,当我使用 Instruments 在模拟器上运行寻找僵尸时,当我尝试关闭包含 UIScrollView 的模式对话框时,我确实会出现僵尸。这是僵尸出现时仪器的屏幕截图:
这里令人抓狂的是,我必须多次打开和关闭模式,然后才会出现崩溃或僵尸出现。而且我没有看到我自己的任何代码出现在僵尸对象的对象摘要历史记录中。