My iOS app crashes unexpectedly using [UIGestureRecognizer _delegateShouldReceiveTouch:] panorama gestures

My iOS app very often fires when [UIGestureRecognizer _delegateShouldReceiveTouch:] with a hard rate. I use gestures to resize and move. While my application is running, the view has multiple instances. Although crash happens very often, it cannot be reproduced reliably. Here is the main part of the crash log.

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000 Crashed Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x39de65b6 objc_msgSend + 22 1 UIKit 0x33e4193e -[UIGestureRecognizer _delegateShouldReceiveTouch:] + 114 2 UIKit 0x33d6f8b2 -[UITouchesEvent _addGestureRecognizersForView:toTouch:currentTouchMap:newTouchMap:] + 782 3 UIKit 0x33d6f394 -[UITouchesEvent _addTouch:forDelayedDelivery:] + 212 4 UIKit 0x33d6f2ac _AddTouchToEvent + 184 5 UIKit 0x33d5d026 _UIApplicationHandleEvent + 5910 6 GraphicsServices 0x35a515a0 _PurpleEventCallback + 588 7 GraphicsServices 0x35a511ce PurpleEventCallback + 30 8 CoreFoundation 0x31f2a170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32 9 CoreFoundation 0x31f2a112 __CFRunLoopDoSource1 + 134 10 CoreFoundation 0x31f28f94 __CFRunLoopRun + 1380 11 CoreFoundation 0x31e9beb8 CFRunLoopRunSpecific + 352 12 CoreFoundation 0x31e9bd44 CFRunLoopRunInMode + 100 13 GraphicsServices 0x35a502e6 GSEventRunModal + 70 14 UIKit 0x33db12fc UIApplicationMain + 1116 15 TestApp 0x0008adb4 0x1c000 + 454068 16 TestApp 0x0001e40c 0x1c000 + 9228 

Does anyone have a similar experience crashing in [UIGestureRecognizer _delegateShouldReceiveTouch:]?

Any hint, theory about how this happens, is appreciated.

+4
source share
1 answer

It looks like the delegate assigned to you by the UIGestureRecognizer instance has been released. Therefore, the gesture recognizer will invoke the delegate method on an object that no longer exists.

Verify that the gesture recognizer delegate is set to zero when an object designated as a delegate is freed. For instance. in the dealloc method.

+3
source

Source: https://habr.com/ru/post/1498295/


All Articles