Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios SVProgressHUD在NSOperationQueue内显示警报_Ios - Fatal编程技术网

Ios SVProgressHUD在NSOperationQueue内显示警报

Ios SVProgressHUD在NSOperationQueue内显示警报,ios,Ios,我有一个注册按钮,通过单击此按钮,我将向NSOperationQueue添加注册操作,但我的问题是,如果用户名字段为空,则不会出现警报。有人建议我向NSOperationQueue添加与注册相关的任务,方法是否正确 - (IBAction)Register:(UIButton *)sender { NSOperationQueue *queue = [NSOperationQueue new]; NSInvocationOperation *operation = [[NSInvoca

我有一个注册按钮,通过单击此按钮,我将向NSOperationQueue添加注册操作,但我的问题是,如果用户名字段为空,则不会出现警报。有人建议我向NSOperationQueue添加与注册相关的任务,方法是否正确

- (IBAction)Register:(UIButton *)sender {

  NSOperationQueue *queue = [NSOperationQueue new];
  NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self
                                                                    selector:@selector(loadDataWithOperation)
                                                                      object:nil];
 [queue addOperation:operation];

}

- (void) loadDataWithOperation {


    if(username.text.length==0)
    { NSLog(@"loadDataWithOperation");

    [SVProgressHUD showSuccessWithStatus:@"Enter User Name"];
    }

 else

    {
      //cose for registration

    }

}
使用此代码:

if ([username.text isEqualToString:@""])
        {
          UIAlertView *alert [[UIAlertView alloc] initWithTitle:@"Message" message:@"Please fill all the fields." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

          [alert show];
        }