Question: I have a problem regarding the `UIAlertView` on iOS7.
When I launch my application, it crashes with the following message:

```
*** Assertion failure in -[UIKeyboardTaskQueue performTask:], /SourceCache/UIKit_Sim/UIKit-2903.2/Keyboard/UIKeyboardTaskQueue.m:388

```

The error occurs on the following line:

```
- (IBAction)updatePositions:(id)sender{
     _alert = [[UIAlertView alloc] initWithTitle:@"text" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
     [_alert show];     <====== IT CRASHS HERE
     [NSThread detachNewThreadSelector:@selector(updateDataThread) toTarget:self withObject:nil];
}

```

I'm using ARC and the property `_alert` is set defined as: `@property (nonatomic,strong)`

This error seems strange, because on iOS6 the code works perfectly and I don't know what should be different on iOS7.

Does anyone have an idea what could the error?

Thanks in advance.

Answer: 
I encountered the same error, and the issue was that the UIAlertView was attempting to be shown from a thread which wasn't the main thread.

The crash however wouldn't always occur, only when a first AlertView was already being shown while this second AlertView was trying to pop up as well.

In my case, a simple fix was to do:

```
    //Your code here
    ...

    //Alert
    _alert = [[UIAlertView alloc] initWithTitle:@"text" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil];

    dispatch_async(dispatch_get_main_queue(), ^{
       //Show alert here
       [_alert show];
       });

    //Resume your code here
    ...

```
You can also do like this:

```
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Your title" message:@"Your message" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];

```

However, if you need to show the same alert in multiple places it's better to create a separate function for it.