I am using code to call a method and show the HUD as below
HUD = [[MBProgressHUD alloc] initWithView:self.view]; [self.view addSubview:HUD]; HUD.delegate = self; HUD.labelText = @"Signing you up"; // myProgressTask uses the HUD instance to update progress [HUD showWhileExecuting:@selector(processFieldEntries) onTarget:self withObject:nil animated:YES]; Within the processFieldEntries I have some error checking which then shows a dialog. Like below:
showDialog: if (textError) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:errorText message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil]; [alertView show]; return; } This then causes a crash, probably because they are on the same thread or not removing the HUD from the view.
My question is should I add different code to ensure they run on different threads? And what should I add to the processFieldEntries method to then remove the HUD as it is called showWhileExecuting...