Problem overriding NSMutableArray?
Problem overriding NSMutableArray?
- Subject: Problem overriding NSMutableArray?
- From: Michael Rogers <email@hidden>
- Date: Wed, 30 May 2001 16:43:54 -0500
I have a class called PhotoAlbumArray that subclasses NSMutableArray (to
be used as a delegate of an NSTableView). PhotoAlbumArray has been
instantiated in the nib file of my project, and connected to the
delegate of an NSTableView.
Unfortunately, at runtime I get errors such as those shown below:
May 30 16:01:49 PhotoAlbum[880] An uncaught exception was raised
May 30 16:01:49 PhotoAlbum[880] *** -objectAtIndex: only defined for
abstract class. Define -[PhotoAlbumArray objectAtIndex:]!
May 30 16:01:49 PhotoAlbum[880] *** Uncaught exception:
<NSInvalidArgumentException> *** -objectAtIndex: only defined for
abstract class. Define -[PhotoAlbumArray objectAtIndex:]!
My first question is, what abstract class? NSMutableArray is concrete,
so presumably its subclass is too. I've overridden
-(id)initWithCapacity: and -(void)awakeFromNib:, and the fact that the
NSLog() statements in both aren't being executed suggests something's
wrong. Come to think of it, when *does* initWithCapacity get called?
How does, by putting it in the nib, the nib figure out that that's the
particular init routine that I want done? I guess it doesn't, and that
I should be overriding just init.
Comments and clarification of the above would be greatly appreciated!
On a related matter, what are the advantages of using a class method
+(id)arrayWithCapacity: as opposed to -(id)initWithCapacity:
TIA,
Michael
------------------------------
Dr. Michael P. Rogers
Mathematics & Computer Science, Millikin University
email@hidden
http://math.millikin.edu/mprogers
217-424-6327(W) 309-828-8655 (H) 309-825-6454(C)