I am able to creat sheet using :
[NSApp beginSheet:scorePanel modalForWindow:mainWindow modalDelegate:self didEndSelector: NULL contextInfo:nil];
I can create sheet when I call this command directly. But when I call the method holding this command from other class I am not able to open sheet getting error :
* Assertion failure in -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:], /So开发者_开发知识库urceCache/AppKit/AppKit-1038.35/AppKit.subproj/NSApplication.m:3100 2011-05-06 18:52:43.282 CoreAnimationWizard[5647:903] Modal session requires modal window
Most likely it is because the window is not hooked up to File's Owner. If the window isn't set you will get that behavior.
Add a new reference outlet to File Owner's window.
精彩评论