ios - iOS13 上的 UISearchController 崩溃
问题描述
在 iOS12 及更早版本上工作,但在 iOS13 上崩溃并出现此错误
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'UISearchController's control over its search bar has been destroyed. Please use the search bar provided by the UISearchController. searchController = <AdvancedSearchController: 0x7fbd9d224a00>, searchBar = <TDSearchBar: 0x7fbd9b768480; baseClass = UISearchBar; frame = (0 0; 1024 50); text = ''; gestureRecognizers = <NSArray: 0x600002791770>; layer = <CALayer: 0x600002ef9be0>>'
我如何解决?这个例外是什么意思?
*** First throw call stack:
(
0 CoreFoundation 0x000000010e296c3e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x000000010e104de0 objc_exception_throw + 48
2 CoreFoundation 0x000000010e296a7c +[NSException raise:format:] + 188
3 UIKitCore 0x000000011fa6e6b0 -[UISearchController _animatorForBarPresentationStyle:dismissing:] + 185
4 UIKitCore 0x000000011fa6eb24 -[UISearchController animationControllerForPresentedController:presentingController:sourceController:] + 34
5 UIKitCore 0x000000011f3a03a0 -[UIViewController _customAnimatorForPresentedController:presentingController:sourceController:] + 154
6 UIKitCore 0x000000011f3a4534 -[UIViewController _presentViewController:withAnimationController:completion:] + 4472
7 UIKitCore 0x000000011f3a6d1b __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 98
8 UIKitCore 0x000000011f3a7233 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 511
9 UIKitCore 0x000000011f3a6c79 -[UIViewController _presentViewController:animated:completion:] + 187
10 UIKitCore 0x000000011f3a6ee0 -[UIViewController presentViewController:animated:completion:] + 150
解决方案
解决了。你不能在 UISearchController 中继承 UISearchBar ......至少在 beta 3 中。
推荐阅读
- c# - 剪贴板监控事件停止触发
- python - flask urlretrieve 事务隔离
- flutter - 如何在函数中设置默认值
- ruby - 有没有办法将文件夹包含在生产构建中但没有 jekyll 编译它?
- bash - 在 BASH 中同时运行两个 xterm 命令
- c# - WebClient 收到的字节数多于 TotalBytesToReceive
- web-deployment - 在 plesk 网络主机上部署 Nuxt.js 项目?
- python - 如何解决“方法 col([class java.util.ArrayList]) 不存在”
- python-3.x - Python 简单的用户名/密码和字典
- linux - SSL 请求在 WSL 上失败