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

前端 未结 13 1138
一生所求
一生所求 2020-12-01 02:34

I have code that creates a UISearchController\' in my UIVIew\'sviewDidLoad`.

 self.resultSearchController = ({
        let controller = UISearch         


        
13条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 03:14

    Solved! It was a simple fix. I changed this code

    class ViewController: UITableViewController, UISearchResultsUpdating, UISearchBarDelegate {
    
        var resultSearchController = UISearchController()
    

    to this:

     class ViewController: UITableViewController, UISearchResultsUpdating, UISearchBarDelegate {
    
        var resultSearchController: UISearchController!
    

    This fixes the problem.

提交回复
热议问题