UISearchController Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior
2016-06-07 19:15
1081 查看
Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7f9c28c9d740>)
出现此类错误的时候很是头疼,因为这是 iOS9.0之类才会出现的错误,具体表现就是当 UISearchBar 出现的时候控制台就会输入此类的信息:
其实也很好解决,可以在 dealloc方法中添加:
[self.searchController.view.superview removeFromSuperview];
也可以在你使用 UISearchController 的位置加上这句代码:
OC 的加这句:
[self.searchController loadViewIfNeeded];
Swift 的加这个:
self.resultSearchController.loadViewIfNeeded()
可以自行验证一下新添加的代码坐在方法里是否执行,只要是执行的都会解决该问题的。
出现此类错误的时候很是头疼,因为这是 iOS9.0之类才会出现的错误,具体表现就是当 UISearchBar 出现的时候控制台就会输入此类的信息:
其实也很好解决,可以在 dealloc方法中添加:
[self.searchController.view.superview removeFromSuperview];
也可以在你使用 UISearchController 的位置加上这句代码:
OC 的加这句:
[self.searchController loadViewIfNeeded];
Swift 的加这个:
self.resultSearchController.loadViewIfNeeded()
可以自行验证一下新添加的代码坐在方法里是否执行,只要是执行的都会解决该问题的。
相关文章推荐
- 用任务管理器关闭客户端后,服务器的早先投递的WSARecv没有从GetQueuedCompletionStatus返回
- iOS开发UI基础—手写控件,frame,center和bounds属性
- UIBezierPath + CAShapeLayer的简单使用
- ndk错误解决方法 ndk-build NDK_PROJECT_PATH
- iOS UIButton实现上显示图片,下显示文字
- HDU 1242 Rescue (BFS+优先队列)
- 3D角色遮挡住UI的实现,关于Stencil Buffer,描边,以及其他
- 11572 - Unique Snowflakes
- easyUI combox 省市县3级联动
- Android逆向分析之dex2jar和jd-gui使用
- assigned , native , identity 区别-Field 'id' doesn't have a default value问题解决方法
- gap锁 对于unique index 和Ununique index
- gap锁 对于unique index 和Ununique index
- gap锁 对于unique index 和Ununique index
- 解题报告:UVA_11235 Frequent Values RMQ_ST + 游程编码
- java.lang.String StringBuffer StringBuilder
- SwipeRefreshLayout.setRefresh(true)指示器不显示
- UGUI 按钮On Click事件
- UIImageView的contentMode
- 解决PKIX:unable to find valid certification path to requested target 的问题