UISearchDisplayController causes crash after viewDidUnload

后端 未结 7 1763
温柔的废话
温柔的废话 2020-12-14 09:50

I have a project using StoryBoards and UISearchDisplayController used in the context of a UINavigationController, that appears in the root viewcont

7条回答
  •  无人及你
    2020-12-14 10:42

    An important point to note, is that crashes like this can occur if you leave the view whilst your searchDisplayController is still active. This is the issue I was having, selecting an item in the searchDisplayController was set to pop the view controller from the stack, in order to fix this, I had to include the following code before the view was popped...

    if (self.searchDisplayController.active) {
    
            [self.searchDisplayController setActive:NO];
    
    }
    

提交回复
热议问题