“Attempting to load the view of a view controller while it is deallocating… UISearchController"

出现的问题原因,从一个控制器modal到一个带有搜索控制器,然后从搜索控制器返回的时候,会出现这个警告

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x154d39700>)

解决办法:
Objective-C...

-(void)dealloc { 
    [searchController.view removeFromSuperview]; // It works!
}

Swift 3...

deinit {
    self.searchController.view.removeFromSuperview()
}

引用

Attempting to load the view of a view controller while it is deallocating… UISearchController

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容