0
votes

I started a TabBar Application in Xcode. Then I added one tab that I called search. Then I created a UITableViewController with the XIB file called SearchController. In MainWindows.xib I linked the third tab to the XIB file "SearchController".

I created IBOutlet for a UISearchBar. In Interface Builder, I added the UISearchBar and when I ran the project everything was OK but when I tried to bind the UISearchBar to my IBOutlet, it raised an exception when I click on the "search" tab:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableViewController 0x4e3ee80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key searchBar.'
*** Call stack at first throw:"
1

1 Answers

1
votes

Did you create the IBOutlet for the UISearchBar as a property? Something like this in your .h file:

@property (strong,nonatomic) IBOutlet UISearchBar *searchBar;

If so, you forgot to synthesize the property in your .m file:

@synthesize searchBar = _searchBar;