UITableView with UISearchBar as the header causes crashes

I have a popover with a UITableViewController as a content view controller. The table view has a UISearchBar as a header.

Everything is fine on iOS 6, but on iOS 7 the application crashes when popover closes, giving this error:

 *** -[UIView release]: message sent to deallocated instance 0x118a9bf0 

Call stack

Any idea on the possible cause of this failure?

+7
ios uitableview ios7 uipopovercontroller uisearchbar
source share
2 answers

Here is how I fixed it. I set the table header view to nil when the view manager is freed:

 - (void)dealloc { self.tableView.tableHeaderView = nil; } 

Although, this does not explain the real reason for the failure.

+7
source share

I [searchBar removeFromSuperview] in dealloc - the same fix.

+7
source share

All Articles