Re: addTabViewItem exception was:(no subject)
Re: addTabViewItem exception was:(no subject)
- Subject: Re: addTabViewItem exception was:(no subject)
- From: J Nozzi <email@hidden>
- Date: Thu, 5 Feb 2004 08:09:42 -0500
My apologies ... I realized as soon as I hit 'send'. Unfortunately,
it was out of my outbox before I could stop it. ;-)
As to your response, I see your addition of "if (anItem)", but other
than that, your code appears to do the same thing as mine. I am
allocating, then initializing an NSTabViewItem. Checking for a valid
reference is one thing, but making a valid reference in the first place
is what I appear to be having trouble with.
- J
On Feb 4, 2004, at 11:43 PM, Jens Bauer wrote:
Hi,
(Please remember specifying a subject, when writing to the list)
On Thursday, Feb 5, 2004, at 04:46 Europe/Copenhagen, J Nozzi wrote:
Hey, List:
Why does this:
NSTabViewItem * anItem = [[NSTabViewItem alloc] initWithIdentifier
@"all"];
[anItem setLabel:@"All"];
[tabView addTabViewItem:anItem];
Do this:
2004-02-04 22:39:56.518 MyApp[4698] Exception raised during posting
of notification. Ignored. exception: *** -[NSCFDictionary
setObject:forKey:]: attempt to insert nil value
... the tabView is an IBOutlet.
anItem is NULL, when you try to add it.
-It didn't get allocated.
addTabViewItem, is like addObject for arrays, and it's not allowed to
add NULL (nil) objects.
You should at least check for NULL objects before adding them:
NSTabViewItem *anItem;
anItem = [[NSTabViewItem alloc] initWithIdentifier @"all"];
[anItem setLabel:@"All"];
if(anItem)
{
[tabView addTabViewItem:anItem];
}
Love,
Jens
_______________________________________________
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.