iOS 13:反复按下取消键时,搜索栏崩溃

时间:2019-10-27 14:06:16

标签: ios swift uisearchbar ios13 uisearchcontroller

当用户反复单击“取消”按钮时,我崩溃了:

  

由于未捕获的异常“ NSInternalInconsistencyException”而终止应用程序,原因:“尚不支持嵌套的内部_UISearchBar转换。这是UIKit内部的错误。'

步骤:

  • 启动一个显示搜索栏的窗口。
  • 将搜索栏文本字段设为第一响应者。我启用了取消按钮,所以它会显示出来。
  • 轻按几次“取消”按钮的位置。
  • 观看应用程序崩溃。

日志:

*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23b98bde __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff503b5b20 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23b98958 +[NSException raise:format:arguments:] + 88
    3   Foundation                          0x00007fff255eb6f5 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
    4   UIKitCore                           0x00007fff468697ba -[_UISearchBarVisualProviderIOS prepareForTransitionToSearchLayoutState:] + 1306
    5   UIKitCore                           0x00007fff46869174 -[_UISearchBarVisualProviderIOS driveTransitionToSearchLayoutState:] + 180
    6   UIKitCore                           0x00007fff471c046a __68-[_UISearchControllerTransplantSearchBarAnimator animateTransition:]_block_invoke.98 + 107
    7   UIKitCore                           0x00007fff4762a1e6 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 528
    8   UIKitCore                           0x00007fff4762a795 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 99
    9   UIKitCore                           0x00007fff471bfc15 -[_UISearchControllerTransplantSearchBarAnimator animateTransition:] + 862
    10  UIKitCore                           0x00007fff46b2c49e ___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 54
    11  UIKitCore                           0x00007fff46c41ece +[UIInputResponderController _pinInputViewsForInputResponderController:onBehalfOfResponder:duringBlock:] + 99
    12  UIKitCore                           0x00007fff46b2c432 ___UIViewControllerTransitioningRunCustomTransition_block_invoke.645 + 180
    13  UIKitCore                           0x00007fff47628751 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 175
    14  UIKitCore                           0x00007fff46b2c2b8 _UIViewControllerTransitioningRunCustomTransition + 553
    15  UIKitCore                           0x00007fff46a0fccb __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.452 + 2632
    16  UIKitCore                           0x00007fff4716b85a _runAfterCACommitDeferredBlocks + 352
    17  UIKitCore                           0x00007fff4715c63c _cleanUpAfterCAFlushAndRunDeferredBlocks + 248
    18  UIKitCore                           0x00007fff4718bc6e _afterCACommitHandler + 85
    19  CoreFoundation                      0x00007fff23afaeb7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    20  CoreFoundation                      0x00007fff23af594e __CFRunLoopDoObservers + 430
    21  CoreFoundation                      0x00007fff23af5fca __CFRunLoopRun + 1514
    22  CoreFoundation                      0x00007fff23af56b6 CFRunLoopRunSpecific + 438
    23  GraphicsServices                    0x00007fff3815cbb0 GSEventRunModal + 65
    24  UIKitCore                           0x00007fff47162a67 UIApplicationMain + 1621
    25  Properly                            0x000000010d3426d2 main + 80
    26  libdyld.dylib                       0x00007fff5123bcf5 start + 1
    27  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

2 个答案:

答案 0 :(得分:0)

简单的解决方案是在点击一次后禁用“取消”按钮。然后执行其下的操作,当过程完成时,您可以根据需要启用它。

答案 1 :(得分:0)

找到以下解决此问题的方法。

<kendo-radialgauge style="width: 300px; height: 300px;">

</kendo-radialgauge>

希望这可以解决问题。