title: EXC_BAD_ACCESS with UIBarButtonItem appearanceWhenContainedIn on iOS 7
body: <pre><code>//Set all cancel buttons in search bars to "Done"
  id searchBarButton = [UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil];
  if([[[UIDevice currentDevice] systemVersion] floatValue] &lt; 7) {
      [searchBarButton setTitle:@"Done"];
  } else {
      //Can't do anything here or i get EXC_BAD_ACCESS
  }
  </code></pre>
  
  <p>This is giving a EXC_BAD_ACCESS when called in <code>viewDidLoad</code> only on iOS 7 Gold Master and newer. iOS 7 beta 6 and older is fine.</p>
  
  <p>Is there a different way to do this in iOS 7?</p>
  
  <p><code>NSLog("%@", searchBarButton)</code> results in this on iOS7:</p>
  
  <p><code>2013-10-01 16:14:25.972 MP Staging[12293:a0b] &lt;_UIBarItemAppearance:0x1aaf72d0&gt; &lt;Customizable class: UIBarButtonItem&gt; when contained in (
      UISearchBar
  ) with invocations (null)&gt;</code></p>
  
  <p>and this on iOS 6 </p>
  
  <p><code>&lt;_UIBarItemAppearance: 0x1c671aa0&gt;</code></p>