I'm using MBPogressHUD in my project and I have all the libraries, imports, etc. set up correctly. However, I'm getting a crash that seems like it has to do with the selector methods. I have a method called "getInfo" that basically connects to a server. The HUD is triggered by pressing a button. After doing some research on the crash, people said to put the initialization in viewWillAppear because some of the init time takes up the time it takes to actually do the task and show the HUD. 

```
    -(void)viewWillAppear:(BOOL)animated {
    connectionHUD = [[MBProgressHUD alloc]initWithView:self.view];
    [self.view addSubview:connectionHUD];
    connectionHUD.labelText = @"Connecting";
    connectionHUD.mode = MBProgressHUDModeAnnularDeterminate;    
}

-(IBAction)connectButton:(id)sender {

    [connectionHUD showWhileExecuting:@selector(getInfo) onTarget:self withObject:nil animated:YES];
}

```

Crash:

```
Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...

-(void)getInfo {

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
UserPi *newPi = [[UserPi alloc]init];
newPi.passWord = self.passTextField.text;
[defaults setObject:self.passTextField.text forKey:@"password"];
newPi.userName = self.userTextField.text;
[defaults setObject:self.userTextField.text forKey:@"username"];
newPi.ipAddress = self.ipTextField.text;
[defaults setObject:self.ipTextField.text forKey:@"ip"];
[newPi connectToServer];
NSString* newAddress = [newPi returnIP];
self.connected = newPi.connected;
[self.delegate sendIP:newAddress];
[self.delegate isConnected:self.connected];
[defaults synchronize];
[self.navigationController popToRootViewControllerAnimated:YES];

}

```

full error:

```
bool _WebTryThreadLock(bool), 0x7327740: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
1   0x3a1ffe9 WebThreadLock
2   0x4ec8ff -[UITextRangeImpl isEmpty]
3   0x4ec4db -[UITextRange(UITextInputAdditions) _isCaret]
4   0x48e7b6 -[UITextSelectionView setCaretBlinks:]
5   0x328f79 -[UIKeyboardImpl setCaretBlinks:]
6   0x3185bc -[UIKeyboardImpl setDelegate:force:]
7   0x3184ae -[UIKeyboardImpl setDelegate:]
8   0x53ff65 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
9   0x29215b -[UINavigationController navigationTransitionView:didStartTransition:]
10  0x418961 -[UINavigationTransitionView transition:fromView:toView:]
11  0x418658 -[UINavigationTransitionView transition:toView:]
12  0x294651 -[UINavigationController _startTransition:fromViewController:toViewController:]
13  0x29489b -[UINavigationController _startDeferredTransitionIfNeeded:]
14  0x295dc6 _popViewControllerNormal
15  0x296065 -[UINavigationController _popViewControllerWithTransition:allowPoppingLast:]
16  0xe6124b0 -[UINavigationControllerAccessibility(SafeCategory) _popViewControllerWithTransition:allowPoppingLast:]
17  0x2961a8 -[UINavigationController popViewControllerWithTransition:]
18  0x2965b9 -[UINavigationController popToViewController:transition:]
19  0x296257 -[UINavigationController popToRootViewControllerWithTransition:]
20  0x2961de -[UINavigationController popToRootViewControllerAnimated:]
21  0x4868 -[ConnectionViewController getInfo]
22  0x126a6b0 -[NSObject performSelector:withObject:]
23  0x8657 -[MBProgressHUD launchExecution]
24  0xca1805 -[NSThread main]
25  0xca1764 __NSThread__main__
26  0x95108ed9 _pthread_start
27  0x9510c6de thread_start

```