View Full Version : Preference panel won't load

Mar 22, 2009, 11:44 AM
Hi. I'm trying to set up a .xib to load my preference panel and it's not happening. I'm not much of a programmer so I was following steps from Cocoa Programming For Mac OSX. The app builds just fine but the preference panel won't load. The tut was for a nib file but so far as I can tell XCode 3.1.2 only works with xib.

The console says:

2009-03-22 12:05:20.295 RaiseMan[4103:10b] -[PreferenceController loadWindow]: failed to load window nib file ':Preferences'.

I have a .m file called PreferencesController and one called AppController.
I think this is all the relevant code. I also made some connections on the Interface Builder.
Preferences linked to AppController's showPreferencePanel action.
Panel title is Preferences

Here is my PreferenceController.m:

#import "PreferenceController.h"
@implementation PreferenceController

-(id) init
if (![ super initWithWindowNibName:@":Preferences"])
return nil;
return self;

NSLog(@"Nib file is loaded");

And here is my AppController.m:

#import "AppController.h"
#import "PreferenceController.h"

@implementation AppController

//Is the prefenceController nil?
if (!preferenceController) {
preferenceController =[[PreferenceController alloc]init];
NSLog(@"showing %@", preferenceController);
[preferenceController showWindow:self];

Thanks in advance.

Mar 22, 2009, 11:53 AM
Never mind I found the Problem

I wrote in a colon into the nib name.

if (![ super initWithWindowNibName:@":Preferences"])

It should read:

if (![ super initWithWindowNibName:@"Preferences"])

Debugging those little things is the worst.