Why does UIActionSheet cancel crahes my App?

Posted by Tim Büthe on Stack Overflow See other posts from Stack Overflow or by Tim Büthe
Published on 2010-04-16T13:49:22Z Indexed on 2010/04/16 13:53 UTC
Read the original article Hit count: 222

Filed under:
|

I try to use the UIActionSheet within my iPhone App but have the following problem. When I tap the cancel button "I don't", the app crashes. When I remove the NSLog statement from the actionSheet:clickedButtonAtIndex: it does not. The "Yes, do it" button works just fine and I see the log statement in the console. What's wrong?

- (void) doItWithConfirm {

    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"do you really wanna do it?" 
                            delegate:self cancelButtonTitle:@"I don't" destructiveButtonTitle: nil
                            otherButtonTitles:@"Yes, do it", nil];

    [actionSheet showInView:self.view];
    [actionSheet release];
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    NSLog(@"buttonIndex: %@", buttonIndex);
}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch