user2551181
user2551181

Reputation: 11

UIAlertView in another UIAlertView blocks keyboard input in the whole app

The problems is that the iOS keyboard sometimes does not react anymore. So no input is possible. If I uncomment the second UIAlertView in clickedButtonAtIndex it works fine.

The reason might be somewhere else? I have no idea ...

Thank you,

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

if(buttonIndex == 1)
{
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];

    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.05 * NSEC_PER_SEC);

    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){

        // User exists already
        RequestObject * requestObject = [RequestObject sharedRequestObject];
        [requestObject loginWithEmail:self.emailTextField.text andPassword:self.passwordTextField.text
                              success:^(UserVO *user) {

                                  // ...

                              } failure:^(ErrorVO *error) {

                                  // User does not exist, create a new one
                                  if (error.code == ERROR_USER_UNKNOWN) {

                                      // ... 

                                  } else {
                                      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"ALERT_CAPTION_ERROR", "<Error>") message:[ErrorCode getErrorMessage:error] delegate:nil cancelButtonTitle:NSLocalizedString(@"ALERT_BUTTON_TEXT_OK", "<Ok>") otherButtonTitles:nil];
                                      [alert show];
                                  } 
                              }];

        [MBProgressHUD hideHUDForView:self.view animated:YES];
    });
}

}

Upvotes: 1

Views: 153

Answers (1)

iPatel
iPatel

Reputation: 47059

When MBProgressHUD starts then you are not able to do any interaction with UI. So it is not possible to do it without any built-in changes of MBProgressHUD.

Upvotes: 1

Related Questions