I have declared the UIAlertViewDelegate to call its methods like this way
-(IBAction)hidding{
[self removeFromParentViewController];
UIAlertView *alert1= [[UIAlertView alloc] initWithTitle:@"Logged in"
message:[NSString stringWithFormat:@"Welcomes you"]
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert1 show];
}
- (void)alertViewUIAlertView *)actionSheet clickedButtonAtIndexNSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
NSLog(@"clicking");
if (buttonIndex == 0)
{
NSLog(@"ok");
}
else
{
NSLog(@"cancel");
}
}
To check which button is clicked and perform some action. However When the UIAlertView appears and when I click on OK option it crashes and gives me the error of *”Program received signal: “EXC_BAD_ACCESS”*.
To be more specific I’ve declared this UIAlertView in 1stclass and then i’m comparing some parameteres in 2ndclass and from 2ndclass it is calling the 1stclass method which has this UIAlertView.
Yes, I used and confirm it However Got the solution, it was like I had to create the @protocol class and declare the -(void)methods in it and then create a delegate in Appdelegate class for it, and also in oneclass. So, I called the @protocol class method and in turn it calls the oneclass method, NOTE: I inherited the @protocol method in oneclass and the issue got resolved.
Here is the complete code for the solution this is the @protocol.h class