Exc_Bad_Access in alertview show
Getting Exc_Bad_Access in UIAlertView show message.
UIAlertView *systemAlert1 = [[UIAlertView alloc]initWithTitle:@"System message" message:@"note" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [systemAlert1 show]; **//Crashing on this line [EXC_BAD_ACCESS]** [systemAlert1 release];
Why i am getting this?? Please help
- NSTimer crashes, when I call or
- NSDictionary: method only defined for abstract class. My app crashed
- Users say that the iOS app crashes without any further explanation
- Xcode Interface Builder crashes when I edit storyboard
- ios App - crash on multiple segue at the same time (going to other segue while one is animating)
- executeFetchRequest:error: A fetch request must have an entity
2 Solutions Collect From Internet About “Exc_Bad_Access in alertview show”
ANY UI stuff including the showing of alerts should be done on Main thread.
If you are doing this on some other thread, it will definitely crash.
It may be because your alert gets invoked from your background thread and not the main thread. It is recommended that user interface related changes should only be made on Main Thread to avoid this kind of behaviors of the application
Try this code:
UIAlertView *systemAlert1 = [[UIAlertView alloc]initWithTitle:@"System message" message:@"note" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [systemAlert1 performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES]; [systemAlert1 release];
Hope this helps. Let me know if you need anything else.
- FBSDKAppInviteDialog in Facebook iOS SDK version 4.0.1 invite successfully sent, but no notifications received
- UIView alpha vs. UIColor alpha
- Uploading UImage to facebook
- Loading images from a URL into a UITableViewCell's UIImageView
- UITextView inside UIScrollView with AutoLayout
- What does 'release' means in this situation on iPhone?
- How to symbolicate crash log Xcode?
- How to add a button to the MKPointAnnotation?
- Objective-C: How do you access parent properties from subclasses?
- For loop for Dictionary don't follow it's order in Swift
- iPad remembering camera permissions after delete—how to clear?
- Issues with extra MIDI track being created in AKsequencer, using audiokit
- Sin(int) is broken in Xcode debugger (lldb)
- Why are touch event listeners seemingly preventing the selection of google translate languages on the iphone or ipad?
- ShareKit Compile Issue – JSONKit not found