Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

amit-battan

macrumors newbie
Original poster
Sep 10, 2009
16
0
Hello Everyone

I am using following code for the Alert this code works fine in Leopard But in snow Leopard application crashes after showing alert


Code:
alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle:@"OK"];
[alert setMessageText:@"Updated Successfully!"];
[alert setAlertStyle:NSWarningAlertStyle];
[alert beginSheetModalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(alertDidEnd4:returnCode4:contextInfo4:) contextInfo:nil];
 
- (void)alertDidEnd4:(NSAlert *)alert returnCode4:(int)returnCode contextInfo4:(void *)contextInfo{
}

I have also tried to use sheet here, but same thing happens If I comment the alert code then application works fine

Please suggest me if anything wrong in my code, or any alternative way

Thanks
Amit Battan
 
Don't autorelease the alert. It should exist until after the sheet is dismissed. Put the autorelease in your alertDidEnd4 method.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.