iOS UISearchController crash: Application tried to present modal view controller on itself

I had that issue when I updated to iOS 11. My scenario was, that I had a Textfield, and when the user started to edit that, a search-view, essentially a tableview with a searchbar as header popped up and once a tableview cell was tapped it should close.

The problem seems to be that since iOS 11, the OS tries to restore the firstResponder state. Long story short.

It helped when I added active = NO, to my did select method, like so

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   self.searchController.active = NO; // Add this !
   ...

   [self dismissViewControllerAnimated:YES completion:nil];
}