lukech lukech - 1 year ago 81
iOS Question

iOS 9 - Keyboard pops up after UIAlertView dismissed

I have a strange visual bug that only affects iOS 9 devices:

My app’s login

runs off and gets an OAuth token when you hit the button, much like you’d expect. If the response from my API returns a specific status code, I pop up a
saying they need to reset their password (this is if they’ve been flagged as such on the server end). The email and password fields for login
once you hit the button, standard stuff.

On iOS 9 only, if you hit the reset path, the second you tap OK on that alert view, the keyboard pops back up, for maybe 800ms, then dismisses again. It’s almost as if something was queued to present it, but the presence of the alert blocked it until you hit OK – it’s absolutely instantaneous after hitting okay on the alert.

It seems a really tricky one to debug. I’ve added symbolic breakpoints to
and it isn’t called anywhere near this process occurring.

Any other ideas for how I can look at debugging / fixing this? It doesn’t affect iOS 7 and iOS 8, only iOS 9.

Answer Source

I faced this problem about 30 minutes ago.

The UIAlertView has been deprecated since iOS9 was released.

We solved this issue by using the UIAlertController, like this:

 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Alert Title!" message:@"This is an alert message." preferredStyle:UIAlertControllerStyleAlert];

     UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
     [alertController addAction:ok];

     [self presentViewController:alertController animated:NO completion:nil];

This should fix your problem.

If animated = YES, you may get the same issue as before. This is a bug with iOS9.

Let me know how it goes, and if this fixes your problem.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download