Attempting to load the view of a view controller while it is deallocating is not allowed and may res
2016-12-07 09:46
711 查看
UISearchController
Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior
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()
可以自行验证一下新添加的代码坐在方法里是否执行,只要是执行的都会解决该问题的。
相关文章推荐
- Attempting to load the view of a view controller while it is deallocating is not allowed and may res
- UISearchController Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior
- UIAlertController:Attempting to load the view of a view controller while it is deallocating is not a
- Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier解决办法
- Warning: Attempt to present ControllerA and ControllerB whose view is not in the window hierarchy!
- It is not possible to run two different versions of ASP.NET in the same IIS process.问题的解决
- SharePoint 2013 搜索报错"Unable to retrieve topology component health. This may be because the admin component is not up and running"
- Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. The parameter is incorrect.
- Warning: Attempt to present BBBViewController on AAAViewController whose view is not in the window hierarchy!
- It is not possible to run two different versions of ASP.NET in the same IIS process
- Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. The parameter is incorrect. (Exception
- It appears as though you do not have permission to view information for any of the hosts you request
- It is not possible to run two different versions of ASP.NET in the same IIS process:IIS
- Sharepoint Error : The URL "filename" is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web
- The URL "filename" is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web
- fix errors 1088: “Failed to execute request because the App-Domain could not be created. Error: 0x80070005 Access is denied” and 1334: “Exception: System.IO.FileLoadException”
- 执行 maven 命令 报错Unable to add module to the current project as it is not of packaging type 'pom'
- INS-35354] The system on which you are attempting to install Oracle RAC is not part of a valid clust
- Unable to add module to the current project as it is not of packaging type 'pom' 问题解决