Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIAlertView Causes Crash in iOS SDK 6.0

I recently submitted an app to App Store that has not been accepted yet. Meanwhile, I downloaded Xcode 4.5 and tested my app in iPhone 6.0 Simulator.

However, when I intend to show an UIAlertView, the app crashes on [myAlertView show] line with EXC_BAD_ACCESS error. It works fine with iPhone 5.1 Simulator.

Here's my code:

UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"Are you sure?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[myAlertView show];  

Is that normal? What am I doing wrong with my code?

Also, do you think I should resend my app to Apple?(Just asking your advice)

Thanks in advance.

Edit: Apple has rejected the app because of iOS 6 crash.

like image 456
kubilay Avatar asked Sep 13 '12 14:09

kubilay


1 Answers

Delete this method and use the other method:

 [myAlertView show];  

Try this Method:

 [myAlertView performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
like image 114
Jordan Avatar answered Oct 14 '22 10:10

Jordan