1

I am having an issue in my App where I have the following structure inside of a Navigation controller:

RootView (Menu) -push-> UITableViewController with a UISearchDisplay Controller -selecting a row pushes-> Detail View Controller for the selected object

On the Detail View Controller, there is an option to return to the main menu which calls:

[self.navigationController popToRootViewControllerAnimated:YES];

All of this works fine on the simulator. When testing on the iPhone 5S, I get a crash.

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000001d2a4beb8
Triggered by Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                 0x000000018f8479d0 objc_msgSend + 16
1   UIKit                           0x000000018689309c -[UISearchBar willMoveToSuperview:] + 64
2   UIKit                           0x0000000186a6cea0 __UIViewWillBeRemovedFromSuperview + 188
3   UIKit                           0x000000018679c3f0 -[UIView(Hierarchy) removeFromSuperview] + 68
4   UIKit                           0x000000018679f4f8 -[UIView dealloc] + 420
5   UIKit                           0x0000000186883350 -[UIScrollView dealloc] + 968
6   UIKit                           0x0000000186943c3c -[UITableView dealloc] + 1300
7   UIKit                           0x0000000186934108 -[UIViewController dealloc] + 460
8   UIKit                           0x00000001869b85f8 -[UITableViewController dealloc] + 288

It seems that it is crashing because for some reason it is not deallocating the UISearchBar. When I delete the Search Display Controller everything works fine.

Also, if I use the "Back" button that is supplied by the UINavigationController, there are no crashes. It is only when I pop to the root from a ViewController that is higher on the stack than Navigation Controller with the search.

Any help would be appreciated as I am totally stumped.

  • EDIT - One additional discovery - All of the delegates seem to be hooked up properly. I am using Storyboard to design the workflow. If I delete the UISearchBar, but DO NOT delete the SearchDisplayController, it does not crash. It seems to only be dependent on the UISearchBar element (which makes sense based on the crash log).

0 Answers0