Re: addTabViewItem exception was:(no subject)
Re: addTabViewItem exception was:(no subject)
- Subject: Re: addTabViewItem exception was:(no subject)
- From: Jens Bauer <email@hidden>
- Date: Thu, 5 Feb 2004 05:43:43 +0100
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.