2016-10-10 74 views
-1

當我打電話裏面uialertviewcontroller方法,我得到了以下問題http://joxi.ru/DrlOO41i4WBNMA如何解僱AlertViewController

如果外界能正常工作。
任何想法 - 將不勝感激。

[[WashappService sharedInstance] auth:^(BOOL value) { 
     if(value==TRUE){ 
      [self presentViewController:[LoginController authConfirmScreen:self toUser:user toPhone:szPhone success:^{ 

       [(MenuClientController*)self.menuContainerViewController.leftMenuViewController updateData]; 

       User* user = [User new]; 
       user = [UserPreference get:KEY_CLIENT]; 
       user.typeOwner = self.isWashAdmin; 
       [UserPreference save:KEY_CLIENT toValue:user]; 
       [[WashappService sharedInstance] updateToken:user.token]; 

       self.nStatusLogin = 1; 
       if (self.isWashAdmin){ 
        OOrdersViewController *vMain = [[UIStoryboard storyboardWithName:@"Main" bundle:NULL] instantiateViewControllerWithIdentifier:@"OOrdersViewController"]; 
        [self.navigationController pushViewController:vMain animated:YES]; 
       }else{ 
        CMainViewController *vMain = [[UIStoryboard storyboardWithName:@"Main" bundle:NULL] instantiateViewControllerWithIdentifier:@"CMainView"]; 

        [self.navigationController pushViewController:vMain animated:YES]; 
       } 


      }] animated:YES completion:nil]; 


     } else { 
      [TSMessage showNotificationWithTitle:NSLocalizedString(@"Error", @"Ошибка") 
             subtitle:NSLocalizedString(@"Login failed", @"Не удалось авторизоваться") 
              type:TSMessageNotificationTypeError]; 

     } 
    } toPhone:szPhone toOwnerType:self.isWashAdmin]; 
+0

的警報控制器? –

+0

後面的代碼 –

回答

0

這裏UIAlertViewController

的代碼

+(UIAlertController *)authConfirmScreen:(UIViewController中*)根TOUSER:(用戶*)用戶toPhone:(的NSString *)電話成功:(無效(^) ())回調{__block_UITextField * fieldCode = nil;

UIAlertController* alertConfirm=[LoginController alert:NSLocalizedString(@"Confirmation", @"Подтверждение") toMsg:NSLocalizedString(@"Enter the verification code", @"Введите проверочный код") toActionTitle:NSLocalizedString(@"Send", @"Отправить") toAction:^(UIAlertAction *action) { 
    [[WashappService sharedInstance] authConfirm:^(BOOL value, User *userNew) { 

     if (value) { 
      [alertConfirm.view removeFromSuperview]; 
      [user apply:userNew]; 
      user.ownernotifications = [NSNumber numberWithInt:OWNER_RECEIVEALWAYS]; 
      [UserPreference save:KEY_CLIENT toValue:user]; 
      [[WashappService sharedInstance] saveDeviceToken:user]; 


      [[WashappService sharedInstance] getFilters:^(BOOL value, Filters *filterNew) { 
       if (value) { 
        Filters* filters = [Filters new]; 
        [filters apply:filterNew]; 
        [UserPreference save:KEY_FILTERS toValue:filters]; 
       } 
      } ]; 

      callback(); 

     } else { 
      [LoginController msgError:root toAction:^(UIViewController *parentIn) { 
       UIAlertController* test= [LoginController authConfirmScreen:parentIn toUser:user toPhone:phone success:callback]; 
       [parentIn presentViewController:test animated:YES completion:nil]; 
      }]; 

     } 
    } toPhone:phone toCode:fieldCode.text]; 
} toTextField:^(UITextField *textField) { 
    fieldCode=textField; 
    textField.keyboardType=UIKeyboardTypeNumberPad; 
    [textField setTintColor:[@"3f3b47" representedColor] ]; 
} toCancelTitle:NSLocalizedString(@"Cancel", @"Отмена")]; 

return alertConfirm; 

}