Error message: [__NSCFType _canScrollX]: unrecognized selector <p>I’m updating an that app usually, but not always, crashes when I swipe from a <code>UIWebView</code> to a <code>UIScrollView</code>. Sometimes it gives the error shown in the title. Most of the time there is no error message. The odd thing is that it does not crash if I use buttons to move to the next screen. The buttons and the swipe gesture recognizer call the same handler.</p> <p>I’m getting the crash on a first generation iPad running iOS 5.1.1 As far as I know it worked fine on whatever version of iOS 5 that was current when I submitted it in June. I download a copy of the app from the app store and it also crashes on the iPad running iOS 5.1.1.</p> <p>My workaround is to disable swiping on versions below 6.0.</p> <pre><code>if ( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0") ) { UISwipeGestureRecognizer *swipeNext; swipeNext = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeNext)]; [swipeNext setDirection:(UISwipeGestureRecognizerDirectionLeft)]; [self.view addGestureRecognizer:swipeNext]; } </code></pre> <p>It works fine when I test it in iOS6 and iOS7. I’m not setting <code>_canScrollX</code>. In fact, I can’t even find that method [edit: It’s probably a property, not a method] in the documentation. I’m only setting two properties on the scrollview.</p> <pre><code>CGFloat quizHeight = ceilf(.9f * _parentView.bounds.size.height - verticalOffset); CGRect quizBounds = CGRectMake(0, verticalOffset, _parentView.bounds.size.width, quizHeight ); _quizView = [[UIScrollView alloc] initWithFrame:quizBounds]; _quizView.delaysContentTouches = YES; _quizView.maximumZoomScale = 1.0f; // Helps with swiping </code></pre> <p>I don’t think it is a memory issue, since it usually crashes on the first screen. I checked my code for methods that aren’t supported in iOS5 and there aren’t any. But even if there were, I’d think the app would crash all the time, instead of some of the time, and it would give me an error message about the selector causing the problem.</p> <p>So I’m stumped. Any thoughts?</p> <p>[Edit{ I tried running with zombies enabled and don’t have any issues. When I use the on-screen button to move from screen to screen, live bytes fluctuates but returns to around 2.4MB. If I swipe, I get a crash and no indication of why in Instruments.</p> <p>The only difference between successful movement from screen to screen and a crash is the swipe gesture. The button on the screen and the swipe gesture recognizer both call the same method.</p> <p>This is the crash log.</p> <pre><code>Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x336f0f78 objc_msgSend + 16 1 UIKit 0x332f50e2 -[UIScrollViewPanGestureRecognizer _centroidMovedTo:atTime:] + 298 2 UIKit 0x332f4f50 -[UIPanGestureRecognizer touchesMoved:withEvent:] + 308 3 UIKit 0x332f4d52 -[UIScrollViewPanGestureRecognizer touchesMoved:withEvent:] + 70 4 UIKit 0x331ec484 -[UIWindow _sendGesturesForEvent:] + 356 5 UIKit 0x331ec1ee -[UIWindow sendEvent:] + 82 6 UIKit 0x331d268e -[UIApplication sendEvent:] + 350 7 UIKit 0x331d1f34 _UIApplicationHandleEvent + 5820 8 GraphicsServices 0x337c4224 PurpleEventCallback + 876 9 CoreFoundation 0x35aa651c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32 10 CoreFoundation 0x35aa64be __CFRunLoopDoSource1 + 134 11 CoreFoundation 0x35aa530c __CFRunLoopRun + 1364 12 CoreFoundation 0x35a2849e CFRunLoopRunSpecific + 294 13 CoreFoundation 0x35a28366 CFRunLoopRunInMode + 98 14 GraphicsServices 0x337c3432 GSEventRunModal + 130 15 UIKit 0x33200cce UIApplicationMain + 1074 16 Comprehension 0x000623d4 main (main.m:14) 17 Comprehension 0x00062388 start + 32 </code></pre>