美文网首页
“Attempting to load the view of

“Attempting to load the view of

作者: 村里竹竿 | 来源:发表于2017-06-20 14:31 被阅读30次

出现的问题原因,从一个控制器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

相关文章

网友评论

      本文标题:“Attempting to load the view of

      本文链接:https://www.haomeiwen.com/subject/pngoqxtx.html