title: Unrecognized selector sent to instance (self.navigationController.toolbar)
body: <p>I've been banging my head against the wall for the past 2 days with it - and I need help.</p>
  
  <p>In my controller, I have this code:</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
      self.navigationController.toolbar.barStyle = UIBarStyleBlack;
      [self.navigationController setToolbarHidden:NO];
  
      ... // the rest of initialisation goes here
  }
  </code></pre>
  
  <p>This controller presents details of one item selected from the list.  Controller displaying a list of items does <code>pushViewControllerAnimated</code> on this controller to display details of the item selected by the user.</p>
  
  <p>This works fine on the first execution, however when the user presses back button - and then selects another (or even the same) item from the list, line <code>[self.navigationController setToolbarHidden:NO]</code> causes <code>SIGABRT</code> with this stack trace:</p>
  
  <pre><code>2011-11-04 10:24:21.423 OOKL[32026:10403] -[NSCFNumber view]: unrecognized selector sent to instance 0x69db0e0
  2011-11-04 10:24:21.426 OOKL[32026:10403] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber view]: unrecognized selector sent to instance 0x69db0e0'
  *** Call stack at first throw:
  (
      0   CoreFoundation                      0x019875a9 __exceptionPreprocess + 185
      1   libobjc.A.dylib                     0x01adb313 objc_exception_throw + 44
      2   CoreFoundation                      0x019890bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
      3   CoreFoundation                      0x018f8966 ___forwarding___ + 966
      4   CoreFoundation                      0x018f8522 _CF_forwarding_prep_0 + 50
      5   UIKit                               0x0063223e -[UIToolbar setItems:animated:] + 1554
      6   UIKit                               0x005f8ccb -[UIViewController(UINavigationControllerContextualToolbar) setToolbarItems:] + 49
      7   OOKL                                0x0003df87 -[OOExplorerObjectDetailController setUpToolbarForExplore] + 1335
      8   OOKL                                0x0003eb2b -[OOExplorerObjectDetailController viewDidLoad] + 2043
      9   UIKit                               0x005fd089 -[UIViewController view] + 179
      10  UIKit                               0x005fb482 -[UIViewController contentScrollView] + 42
      11  UIKit                               0x0060bf25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
      12  UIKit                               0x0060a555 -[UINavigationController _layoutViewController:] + 43
      13  UIKit                               0x0060b870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
      14  UIKit                               0x0060632a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
      15  UIKit                               0x0060d562 -[UINavigationController pushViewController:transition:forceImmediate:] + 932
      16  UIKit                               0x006061c4 -[UINavigationController pushViewController:animated:] + 62
      17  OOKL                                0x0002ed8b -[OOExploreController showObjectDetailControllerWithObject:] + 571
      18  OOKL                                0x0002da1c -[OOExploreController parserDidFinish:] + 316
      19  OOKL                                0x00021c13 -[OOXMLParser parserDidEndDocument:] + 99
      20  Foundation                          0x00385717 _endDocument + 95
      21  libxml2.2.dylib                     0x02ad4215 xmlParseChunk + 7380
      22  Foundation                          0x0038615a -[NSXMLParser parse] + 321
      23  OOKL                                0x00021893 -[OOXMLParser parseString:] + 339
      24  OOKL                                0x0002d8d5 -[OOExploreController parseXml:] + 165
      25  OOKL                                0x0002d81f -[OOExploreController requestDidFinishLoading:] + 79
      26  OOKL                                0x00011cba -[OOSharedSeverController connectionDidFinishLoading:] + 298
      27  Foundation                          0x002ef112 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108
      28  Foundation                          0x002ef06b _NSURLConnectionDidFinishLoading + 133
      29  CFNetwork                           0x013cd48e _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 220
      30  CFNetwork                           0x014986e1 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 293
      31  CFNetwork                           0x013c3c80 _ZN19URLConnectionClient13processEventsEv + 100
      32  CFNetwork                           0x013c3acf _ZN17MultiplexerSource7performEv + 251
      33  CoreFoundation                      0x019688ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
      34  CoreFoundation                      0x018c688b __CFRunLoopDoSources0 + 571
      35  CoreFoundation                      0x018c5d86 __CFRunLoopRun + 470
      36  CoreFoundation                      0x018c5840 CFRunLoopRunSpecific + 208
      37  CoreFoundation                      0x018c5761 CFRunLoopRunInMode + 97
      38  GraphicsServices                    0x01e601c4 GSEventRunModal + 217
      39  GraphicsServices                    0x01e60289 GSEventRun + 115
      40  UIKit                               0x0055bc93 UIApplicationMain + 1160
      41  OOKL                                0x00002d09 main + 121
      42  OOKL                                0x00002c85 start + 53
  )
  </code></pre>
  
  <p>I thought, maybe, I should setup <code>self.toolbarItems</code> first before making the toolbar visible - but then I get this same error when I do</p>
  
  <pre><code>self.toolbarItems = [NSArray ...]
  </code></pre>
  
  <p>I'm desperate now - any help is appreciated.</p>
  
  <p><strong>Edit</strong>: Now for some reason I'm getting <code>EXC_BAD_ACCESS</code> instead of <code>SIGABRT</code> - in the same place - and no stack trace is produced at all.</p>