Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
Hi, I am using Cocoa with Obj-C
I am trying to set the first entry under NSPopupButton using [popup selectItemAtIndex:0] in awakeFromNib of the window. I have only one entry in popup button.
But it is returning run time exception.
2008-01-31 19:52:55.493 Appln 3[13912] *** Assertion failure in -[NSMenu itemAtIndex:], Menus.subproj/NSMenu.m:713
2008-01-31 19:52:55.493 Appln 3[13912] Exception raised during posting of notification. Ignored. exception: Invalid parameter not satisfying: (index >= 0) && (index < (_itemArray ? CFArrayGetCount((CFArrayRef)_itemArray) : 0))

What might be the cause?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Looks like your popup button doesn't have any items in it. That is why an index of 0 is failing. Check [[popupButton menu] numberOfItems]
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.