Problem using sheets (selector not recognized)
07/01/04 10:06 
I'm trying to implement sheets into my app except every time the method is called to begin the sheet i get this warning in the console: 2004-01-07 01:57:08.026 PP[672] *** -[NSApplication beginSheet:modalForWindow:modalForDelegate:didEndSelector:contextInfo:]: selector not recognized 2004-01-07 01:57:08.030 PP[672] *** -[NSApplication beginSheet:modalForWindow:modalForDelegate:didEndSelector:contextInfo:]: selector not recognized
| I've been trying to resolve this problem with no luck. Here is my code: | 
- (IBAction)openSaveSheet:(id)sender
{
	SEL selector = @selector(sheetDidEnd:returnCode:contextInfo:);
	
	[NSApp beginSheet:saveSheet
	   modalForWindow:[self window]
	 modalForDelegate:self
	   didEndSelector:selector                            //@selector(sheetDidEnd:returnCode:contextInfo:)
		  contextInfo:NULL];	
}
- (IBAction)clearProjectile:(id)sender
{
}
- (IBAction)saveProjectile:(id)sender
{
	[saveSheet orderOut:sender];
	[NSApp endSheet:saveSheet returnCode:1];
}
- (IBAction)cancelSave:(id)sender
{
	[saveSheet orderOut:sender];
	[NSApp endSheet:saveSheet returnCode:0];
}
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
	if (returnCode == 1) {
		NSLog(@"user chose to save");
	}
	else {
		NSLog(@"user chose to cancel");
	}
	[saveSheet orderOut:nil];
}
Any suggestions would be greatly appreciated :-) -John Przyborski Answer: The correct signature of method is
- (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo
see
modalDelagate
where you typed
modalForDelegate
.
  |