Preference panel won't load

Discussion in 'Mac Programming' started by elindividuo123, Mar 22, 2009.

  1. macrumors newbie

    Joined:
    Mar 22, 2009
    #1
    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:

    Code:
    #import "PreferenceController.h"
    @implementation PreferenceController
    
    -(id) init
    {
    	if (![ super initWithWindowNibName:@":Preferences"])
    		return nil;
    	return self;
    }
    
    -(void)windowDidLoad
    {
    	NSLog(@"Nib file is loaded");
    }
    
    And here is my AppController.m:

    Code:
    #import "AppController.h"
    #import "PreferenceController.h"
    
    @implementation AppController
    
    -(IBAction)showPreferencePanel:(id)sender
    {
    	//Is the prefenceController nil?
    	if (!preferenceController) {
    		preferenceController =[[PreferenceController alloc]init];
    	}
    	NSLog(@"showing %@", preferenceController);
    	[preferenceController showWindow:self];
    }
    @end
    
    
    Thanks in advance.
     
  2. thread starter macrumors newbie

    Joined:
    Mar 22, 2009
    #2
    Never mind I found the Problem

    I wrote in a colon into the nib name.

    It should read:

    Debugging those little things is the worst.
     

Share This Page