• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
unexpected nil outlet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unexpected nil outlet


  • Subject: unexpected nil outlet
  • From: William Squires <email@hidden>
  • Date: Tue, 17 Jun 2008 19:47:42 -0500

I'm trying to code a solution to the challenge "Make a Delegate" in chapter 6 of the new Hillegaas book. Here is my AppController.h

@interface AppController : NSObject
{
IBOutlet NSWindow *window;
}

@end

and my AppController.m

#import <Cocoa/Cocoa.h>
#import "AppController.h"

@implementation AppController

- (id) init
{
NSLog(@"init");
if ([super init])
  {
  // Register self as delegate
  NSLog(@"window = %@", window);
  [window setDelegate:self];
  }
return self;
}

- (NSSize) windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
{
NSSize newSize;

NSLog(@"windowWillResize:toSize:");
newSize.height = frameSize.height;
newSize.width = frameSize.height * 2;
return newSize;
}

I then launched IB on MainMenu.xib, added an Object to MainMenu.xib window, changed its class to AppController, and connected its outlet to the window (right-click on object, then drag from the circle to the window.) I can confirm the connection is made in IB, but when I launch the app in Xcode (3.1), I get the message:

2008-16-07 19:40:44:335 WindowServer[2413:10b] window = (null)

from my NSLog() in the init() method! What (simple, stupid, dumbhead) thing have I missed?

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: unexpected nil outlet
      • From: David Reynolds <email@hidden>
    • Re: unexpected nil outlet
      • From: Jonathan Hess <email@hidden>
    • Re: unexpected nil outlet
      • From: "David Wilson" <email@hidden>
    • Re: unexpected nil outlet
      • From: William Squires <email@hidden>
  • Prev by Date: Re: Grand Central Details
  • Next by Date: Re: Convert CGImageRef from BGR to RGB
  • Previous by thread: [MODERATOR] Re: Grand Central Details
  • Next by thread: Re: unexpected nil outlet
  • Index(es):
    • Date
    • Thread