Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1003331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:57:51+00:00 2026-05-16T07:57:51+00:00

I have an NSWindowController subclass called _PreferencesWindowController with the following implementation – @synthesize window;

  • 0

I have an NSWindowController subclass called _PreferencesWindowController with the following implementation –

@synthesize window;

- (id)init {

 self = [super initWithWindowNibName:@"PreferencesWindow"];
 if (!self) return nil;

 return self;
}

And I tried to show the window in _PreferencesWindowController by using the following code –

_preferencesWindowController = [[_PreferencesWindowController alloc] init];
[_preferencesWindowController showWindow:nil];

It does nothing, and I checked _preferencesWindowController.window is nil from the debugger.

However if I call loadView on _preferencesWindowController the window can be loaded and is visible; _preferencesWindowController.window is no longer nil-valued –

[_preferencesWindowController loadWindow];

I looked at Apple’s documentation on NSWindowController it specifically says “you should never directly invoke loadWindow“, instead showWindow: should be used. I’m wondering what I might have missed that resulted in the above-mentioned behaviour I have been seeing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:57:52+00:00Added an answer on May 16, 2026 at 7:57 am

    OK I solved this by looking at the NSWindowController header file.

    The problem is in my header file for _PreferencesWindowController –

    @interface _PreferencesWindowController : NSWindowController <NSToolbarDelegate> {
    
        NSWindow *window;
    
    }
    
    @property (assign) IBOutlet NSWindow *window;
    
    @end
    

    By removing the @property declaration and changing NSWindow *window ivar to IBOutlet NSWindow *window, showWindow: method now works without a glitch.

    The property declaration must have resulted in an undefined behaviour in showWindow: method in NSWindowController‘s implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Cocoa app using a NSWindowController subclass. In the nib I
I have a custom NSWindowController subclass that loads a NIB file during initialization like
I have a nib (winA.xib) that contains a window. My app delegate contains an
I have a multithreaded application that has many concurrent operations going on at once.
I'm seeking further clarification after seeing What is responsible for releasing NSWindowController objects? I'm
I've had a crack at implementing bindings for my own NSView subclass. It works,
I am trying to display a custom sheet in my application, but I think
I'm wondering what are the recommended ways to handle situations where, in memory managed
I am having an issue wrapping my head around how to hook up a
I'm trying to build my first cocoa application. done some iPhone developing before. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.