Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modal Session requires Modal Window Error on Mac

I need to launch a modal window from a plugin in a video application. I created a Nib in Interface builder along with an NSWindowController class. But when I try to run the window like this

Registration* newWin = [[Registration alloc] initWithWindowNibName:@"Options"];

[NSApp runModalForWindow: [newWin window]];

It gives me an error in the Console : Modal Session requires Modal Window I think it has something to do with Interface Builder (Pardon me, I am really new to IB).

Here is the link to the Nib file and the Classes. I would appreciate it if someone could tell me what I did wrong in IB. Thanks.

[Link Removed]

like image 624
rwb Avatar asked Nov 25 '10 06:11

rwb


1 Answers

You instantiated an instance of Registration in the nib file. That's not the way you prepare a nib file for use with an NSWindowController. That Registration object is a distinct object contained in the nib file, not the Registration object you allocated in the code you quoted above.

In the nib passed to initWithWindowNibName, the File's Owner is the NSWindowController instance you create in the code. So, in the inspector, set the class name of the File's Owner to be Registration and connect its window outlet to be your window object inside the nib file.

like image 133
Yuji Avatar answered Nov 06 '22 17:11

Yuji