0

I called

[self.navigationItem setRightBarButtonItems:nil animated:YES];

to hide the buttons during refresh operations

Sometimes I caught an exception saying

*** setObjectForKey: object cannot be nil (key: kUINavigationBarAnimationRightViews)
Tim
  • 1,877
  • 19
  • 27

1 Answers1

0

Previously the rightBarButtonItems array contained an item with a custom view - a UISearchBar being a firstResponder.

Calling the following line of code caused the crash

[self.navigationItem setRightBarButtonItems:nil animated:YES];

The solution

Simply calling

self.searchBar resignFirstResponder];

solved the issue

Tim
  • 1,877
  • 19
  • 27