奇葩奔溃[__NSCFSet addObject:]: attempt to insert nil

错误如下:
2019-05-09 16:37:35.827888+0800 testViewDidDisAppear[53407:2544033] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFSet addObject:]: attempt to insert nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010c0b11bb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000010b64f735 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010c0b1015 +[NSException raise:format:] + 197
    3   CoreFoundation                      0x000000010c08c8da -[__NSCFSet addObject:] + 202
    4   UIKitCore                           0x0000000110a22d42 -[UIGestureRecognizer requireGestureRecognizerToFail:] + 158
    5   testViewDidDisAppear                0x000000010ad30156 -[TestCtrl viewDidDisappear:] + 198
    6   UIKitCore                           0x000000011082a3cf -[UIViewController _setViewAppearState:isAnimating:] + 574
    7   UIKitCore                           0x000000011082ae01 -[UIViewController __viewDidDisappear:] + 132
    8   UIKitCore                           0x000000011082aef5 -[UIViewController _endAppearanceTransition:] + 197
    9   UIKitCore                           0x000000011077bd79 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 997
    10  UIKitCore                           0x000000011076fbe0 __49-[UINavigationController _startCustomTransition:]_block_invoke + 241
    11  UIKitCore                           0x0000000110850c39 -[_UIViewControllerTransitionContext completeTransition:] + 102
    12  UIKitCore                           0x0000000110863258 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke.124 + 871
    13  UIKitCore                           0x0000000111320753 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 847
    14  UIKitCore                           0x00000001112f334d -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 343
    15  UIKitCore                           0x00000001112f398d -[UIViewAnimationState animationDidStop:finished:] + 293
    16  UIKitCore                           0x00000001112f3a41 -[UIViewAnimationState animationDidStop:finished:] + 473
    17  QuartzCore                          0x000000010e6e1cad _ZN2CA5Layer23run_animation_callbacksEPv + 323
    18  libdispatch.dylib                   0x000000010d9af602 _dispatch_client_callout + 8
    19  libdispatch.dylib                   0x000000010d9bc99a _dispatch_main_queue_callback_4CF + 1541
    20  CoreFoundation                      0x000000010c0163e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    21  CoreFoundation                      0x000000010c010a76 __CFRunLoopRun + 2342
    22  CoreFoundation                      0x000000010c00fe11 CFRunLoopRunSpecific + 625
    23  GraphicsServices                    0x00000001103fb1dd GSEventRunModal + 62
    24  UIKitCore                           0x0000000110e4381d UIApplicationMain + 140
    25  testViewDidDisAppear                0x000000010ad302c0 main + 112
    26  libdyld.dylib                       0x000000010da25575 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
原因:在viewDidDisappear 如果调用以下代码requireGestureRecognizerToFail,就会崩溃,示例如下:
- (void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    
    [_scrollView.panGestureRecognizer requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer];
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容