title: UIAlertController Does Not Return User Input
body: <p>I'm using <code>UIAlertController</code> for the first time.  I need to prompt the user for an input.  Anyway, the following is what I have.</p>
  
  <pre><code>- (void)showAlert {
      UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Hello!" message:@"Type something.") preferredStyle:UIAlertControllerStyleAlert];
      UIAlertAction *noButton = [UIAlertAction actionWithTitle:@"Cancel") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  
      }];
      UIAlertAction *yesButton = [UIAlertAction actionWithTitle:@"Enter") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
          //NSString *input = alert.textFields[0].text;
          //NSLog(@"input was '%@'", input);
          UITextField *textField = alert.textFields[0];
          NSLog(@"%@",textField.text); // &lt;====== It's not returned
  
      }];
      [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
          [textField addTarget:self action:@selector(alertTextFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
          [yesButton setEnabled:NO];
      }];
      [alert addAction:noButton];
      [alert addAction:yesButton];
      [self presentViewController:alert animated:YES completion:nil];
  }
  
  - (void)alertTextFieldDidChange:(UITextField *)sender {
      UIAlertController *alertController = (UIAlertController *)self.presentedViewController;
      if (alertController) {
          UITextField *textfield = alertController.textFields.firstObject;
          UIAlertAction *okAction = alertController.actions.lastObject;
          okAction.enabled = [self validateName2:textfield.text:5]; // function for validating user input
      }
  }
  </code></pre>
  
  <p>For some reason, when the user tap Yes, the application doesn't return user input.  In fact, Xcode dashes 'text' as in '<code>NSString</code> *input = alert.textFields[0].text.  A strange thing is that <code>UIAlertView</code> doesn't return user input.  That's why I've switched to <code>UIAlertController</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/cuDjO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cuDjO.png" alt="enter image description here"></a></p>
  
  <pre><code>- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
      if ([alertView tag] == 101) {
          if (buttonIndex == 1) {
              NSString *username = [[alertView textFieldAtIndex:0] text];
              NSLog(@"%@",username); // &lt;====== It's never returned.
          }
      }
  }
  </code></pre>
  
  <p>Anyway, I wonder what I'm doing wrong with <code>UIAlertController</code>?</p>
  
  <p>Muchos thankos</p>
  
  <p>p.s.  I'm using Xcode 6.4 (6E35b).  This issue may be caused by Xcode.  If I debug the code with the iPad2 simulator, it'll actually return user input while it doesn't if I use the iPhone4S simulator. </p>