I am trying to make search in my UITableViewController using UISearchController. For starter project i use Apple's example. I made some changes and I want to use one class instead of thee as in example. I am adding my UISearchController from code. My problem is I cannot call UISearchController because of exeption :
2015-06-18 13:35:04.750 TableSearch[4796:77813] Warning: Attempt to present <UISearchController: 0x7fe09b719f00> on <APLMainTableViewController: 0x7fe09b50e450> whose view is not in the window hierarchy!
Working project with changes
Can someone please tell me what I did wrong? Thanks!
Updated answer:
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
For those wanting a working example with search results, see my repo https://github.com/Optimbyte/IOSVC-master
Old answer:
I think you forgot to add in MainStoryBoard a search bar and search display controller.
Problem is that I wanted to run UISearchController :
self.searchController = [[UISearchController alloc] initWithSearchResultsController:self];
Solution is to initialise UISearchController :
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
and leave storyboard as it was.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With