views:

489

answers:

2

Hello,

I have implemented an NSAlert but the delegate method didDissmissWithButton is never called.

This code evokes the NSAlert:

NSString *title = [NSString stringWithFormat:@"Keine Internetverbindung"];
        NSString *alertMessage = [NSString stringWithFormat:@"Es konnte keine Verbindung zu www.sip.de aufgebaut werden!"];
        NSString *ok = [NSString stringWithFormat:@"Ok"];               

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:alertMessage  delegate:self cancelButtonTitle:ok otherButtonTitles:nil];

        [alert show];
        [alert release];

and this is the NSAlert delegate method:

- (void)alertView:(UIAlertView *)alertView didDisMissWithButtonIndex:(NSInteger)buttonIndex{
    exit(3);
}

The method is never called, what is my mistake?

+1  A: 

You have a typo in method name: didDisMissWithButtonIndex must be didDismissWithButtonIndex

As a side note: remember that quitting from app programmatically is not advisable by Apple's HIG.

Vladimir
You are right, it isn't very good to close the app by this way!---> bad ideathank you for helping
Marco
@Marco - If this answer solves your problem make sure to hit the checkmark beside it so the system flags the question as answered and so that Vladimir will get the credit for the correct answer.
TechZen
A: 
TechZen
actually, delegate is set in alert initialization so it must not be a problem
Vladimir
Man, I'm slow today. I should post before the caffeine kicks in
TechZen