title: When assigning focus via becomeFirstResponder to UISearchController's UISearchBar, the keyboard does not appear
body: <p>I've spent quite a bit of time searching online and talking to other developers about this issue to no avail. The exact issue is described in this SO post (<a href="https://stackoverflow.com/questions/5474529/focus-on-the-uisearchbar-but-the-keyboard-not-appear">Focus on the UISearchBar but the keyboard not appear</a>), although it's many years old.</p>
  
  <p>I recently switched from using the deprecated UISearchDisplayController and UISearchBar in IB, and switched over to UISearchController via the code for iOS8.</p>
  
  <p>The problem I'm getting however, is that focus is assigned correctly (you can tell because the cancel button animates to the right of the search bar after the view loads), however the keyboard does not show up.</p>
  
  <p>Here's the code that I have.</p>
  
  <p>.h</p>
  
  <pre><code>@property (nonatomic, strong) UISearchController *searchController;
  </code></pre>
  
  <p>.m</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
      ...
      [self initializeSearchController];
      ....
  }
  
  - (void)viewDidAppear:(BOOL)animated {
      [super viewDidAppear:animated];
      [self.searchController setActive:YES];
      [self.searchController.searchBar becomeFirstResponder];
  }
  
  - (void)initializeSearchController {
      self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
      self.searchController.searchResultsUpdater = self;
      self.searchController.dimsBackgroundDuringPresentation = NO;
      self.searchController.delegate = self;
      self.searchController.searchBar.delegate = self;
      [self.searchController.searchBar sizeToFit];
  
      [self.tableView setTableHeaderView:self.searchController.searchBar];
      self.definesPresentationContext = YES;
  }
  </code></pre>
  
  <p>The things I've tried so far.</p>
  
  <ul>
  <li><p>I've tried calling becomeFirstResponder on a 0.2 second delay, as suggested in another SO post.</p></li>
  <li><p>I've set a breakpoint in viewDidAppear, and verified that both self.searchController and self.searchController.searchBar are both valid objects, neither nil.</p></li>
  <li><p>I've tried conforming to the UISearchControllerDelegate and using the following snippet of code</p></li>
  </ul>
  
  <p>here:</p>
  
  <pre><code>- (void)didPresentSearchController:(UISearchController *)searchController {
      //no matter what code I put in here to becomeFirstResponder, it doesn't
      //matter because this is never called, despite setting the     
      //self.searchController.delegate = self AND 
      //self.searchController.searchBar.delegate = self.
  }
  </code></pre>
  
  <ul>
  <li><p>I've created a new view from scratch in storyboards, and segued to that one instead, to make sure I didn't have some old searchBar remnant in my view. This did not work either.</p></li>
  <li><p>I've only tested this on a real device (iPhone 6), and it's not a simulator issue of not showing the keyboard.</p></li>
  </ul>
  
  <p>I'm out of ideas, and I've seen every question and answer related to this one the web. Nothing is working.</p>
  
  <p>To clarify again what's going on, the searchBar correctly becomes the first responder, the cancel button to the right of it animates onscreen proving this, but the keyboard does not appear and the cursor does not blink in the searchBar. </p>