hi. I have a window with 3 comboboxes. one of them uses a data source. the problem is that it keeps throwing an exception, and i can't find out why. I've put the following methods in my appcontroller:
-(NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox { return (NSInteger)[symbols count]; } -(id)comboBox:(NSComboBox *)sender objectValueForItemAtIndex:(NSInteger)index { return [symbols objectAtIndex:index]; } symbols is an NSMutableArray which can contain any number of NSStrings (I initialize it with 5 NSStrings) when i try to launch the app from within xcode, the console shows the following: 2010-03-18 19:26:28.515 StoX[63999:a0f] An uncaught exception was raised 2010-03-18 19:26:28.534 StoX[63999:a0f] *** -[NSCFArray objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (5) 2010-03-18 19:26:28.596 StoX[63999:a0f] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (5)' *** Call stack at first throw: ( 0 CoreFoundation 0x00007fff87ddb444 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x00007fff800470f3 objc_exception_throw + 45 2 CoreFoundation 0x00007fff87ddb267 +[NSException raise:format:arguments:] + 103 3 CoreFoundation 0x00007fff87ddb1f4 +[NSException raise:format:] + 148 4 Foundation 0x00007fff8798e080 _NSArrayRaiseBoundException + 122 5 Foundation 0x00007fff878f0b81 -[NSCFArray objectAtIndex:] + 75 6 AppKit 0x00007fff80ba2012 -[NSComboBoxCell selectItemAtIndex:] + 191 7 StoX 0x0000000100001693 -[AppController awakeFromNib] + 50 8 CoreFoundation 0x00007fff87d8a82d -[NSSet makeObjectsPerformSelector:] + 205 9 AppKit 0x00007fff8086c913 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1445 10 AppKit 0x00007fff8086ab49 loadNib + 226 11 AppKit 0x00007fff8086a059 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 248 12 AppKit 0x00007fff80869e91 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 326 13 AppKit 0x00007fff80867413 NSApplicationMain + 279 14 StoX 0x00000001000015a8 start + 52 ) terminate called after throwing an instance of 'NSException' i've checked that i'm using the types that the docs say i should be using, but i don't understand why index comes back as -1. am i doing something wrong? should I be doing something i'm not doing? is the documentation wrong? is there a bug somewhere?_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com