• 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
Re: Cocoa Book
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Book


  • Subject: Re: Cocoa Book
  • From: Sherm Pendley <email@hidden>
  • Date: Sun, 20 Apr 2003 23:42:32 -0400

On Sunday, April 20, 2003, at 10:32 PM, John MacMullin wrote:

I have worked my way through the O'Reilly book Cocoa Applications A step by step guide. I have followed the directions in Chapter 11. However, when I run the program, I get an error message:

1325 ***-[NSCFDictionarysetObject:forKey:]:attempt to insert nil value

and no window appears at all.

Could you first direct me to a list of the error codes, if there is one, and then provide some assistance.

I can't help you with the error codes. The message basically says it all, anyway - you're attempting to insert a nil value in a dictionary object. The error code docs will go into painful detail about why nils aren't allowed in dictionaries, but that wouldn't be of any help with the important questions: What dictionary is complaining? And, where is the nil value coming from?

Judging by the symptoms you describe - no window appears - I'd guess that the call to initWithWindowNibName is returning nil. Further, I'd also guess that NSDocument keeps a list of its window controllers in a dictionary, and the call to [self addWindowController: ctl] is the source of the error message. I tested my theory by compiling a simple doc-based app that simply passed nil to addWindowController:, with similar results.

You could check to see if ctl is nil by inserting an NSLog() just before the call to addWindowController:, something like this:

if (nil == ctl) {
NSLog(@"ctl is nil");
} else {
NSLog(@"ctl is %@", [ctl description]);
}

If ctl is nil, the next step is to figure out why. The most likely cause is a mismatch between what is returned by [self windowNibName] and the actual name of the Nib. If you're passing a constant string to initWithWindowNibName:, instead of calling windowNibname, there could be a typo in that string.

I'm using 10.1, and I haven't seen your code, so take this with a grain of salt - or as JCR would say, "adjust salinity accordingly."

sherm--


If you listen to a UNIX shell, can you hear the C?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Cocoa Book (From: John MacMullin <email@hidden>)

  • Prev by Date: Re: globals and memory leaks
  • Next by Date: Re: Cocoa Window Not Activated When Called From Carbon Application
  • Previous by thread: Cocoa Book
  • Next by thread: cocoa.mamasam.com
  • Index(es):
    • Date
    • Thread