Search code examples
xcode7osx-elcapitannswindowcontroller

NSWindowController El Capitan Compatible?


I'm trying to build my project with xCode 7.0.1 on El Capitan. Previously NSWindowController has worked to display our splash screen windows, but since upgrading to El Capitan to test our plug-in compatibility, no Windows are displayed.

Here's the code I use to display the splash screen (Worked fine in previous OS X):

pcim_splashcontroller * splash = [[pcim_splashcontroller alloc] initWithWindowNibName:@"pcim_splash"];
[[splash window] center];

// Slight time delay here...

[splash close];
[splash release];

pcim_splashcontroller is specified as such:

@interface pcim_splashcontroller : NSWindowController
{
    IBOutlet NSTextField *ExpiresLabel;
    IBOutlet NSTextField *CopyrightLabel;
    NSUInteger DaysRemaining;
}

Has anyone else been successful in using NSWindowController in El Capitan? Originally the plug-in was built in Yosemite, so I tried rebuilding in El Capitan with the latest version of xCode and have had no luck so i'm wondering if it's a compatibility issue with the new OS X.

When I step through with debugger, no errors appear and the splash pointer seems to allocate appropriately. I've also tried adding in:

[splash showWindow:nil]

But this didn't seem to help either.

Thank you very much.


Solution

  • It seems El Capitan has some sort of cache for NSWindow, probably managed on the main runloop.

    Try this :

    [[splash window] center];
    
    [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 1]];
    
    [splash close];