Q:

Basic use of UIAlertView causes EXC_BAD_ACCESS

I'm implementing a very simple iOS application just to practice showing a pop up alert in, and I get an error when I press the alert button:

Thread 1:EXC_BAD_ACCESS(code=1,address=0x676f6f57)

This is the code: 
- (IBAction)AlertButton {

    alert = [[UIAlertView alloc]
         initWithTitle:@"Alert" message:@"Alert"
         delegate:self
         cancelButtonTitle:@"Dismiss"
         otherButtonTitles:@"Apple", "Google" ,nil];
    [alert show];}

-(void)alertView :(UIAlertView *)alertView clickedButttonAtIndex:(NSInteger)buttonIndex{

    if(buttonIndex == 1){
        [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://apple.com"]];
    }
    if(buttonIndex == 2){
        [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://google.com"]];
    }}

A:

the problem is with the constructor of the UIAlertView, in the line:
otherButtonTitles:@"Apple", "Google" ,nil];

your forget the @ before "Google". And finally change:
-(void)alertView :(UIAlertView *)alertView clickedButttonAtIndex:(NSInteger)buttonIndex{

by
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {

