I have subclassed NSMutableArray as follows:
Base Class:
@interface MyBaseMutableArray : NSMutableArray {
// Database variables
NSString * databaseName;
NSString * databasePath;
}
@property (nonatomic, retain) NSString * databasePath;
- (id)initWithContentsOfSQLiteDB:(NSString *)dbTable;
-(void) checkAndCreateDatabase;
-(void) readFromDatabase;
@end
Subclass:
@interface IngredientsMutableArray : MyBaseMutableArray
{
}
-(void) readFromDatabase;
@end
When I create an IngredientsMutableArray I do the following:
IngredientsMutableArray * i = [[IngredientsMutableArray alloc]
initWithContentsOfSQLiteDB:@"MyIngredientsDB.sql"];
BUT, when I try to perform the [self addObject:ingred] I throw an exception as follows:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSArray count]: method only defined for abstract class. Define -[IngredientsMutableArray count]!'
I believe I am not initializing the NSMutableArray correctly. I was going to us initWithCapaciity, but I do not know the count before the SQL call. I think I am overlooking something obvious, but being somewhat of a newbie to Objective C I am slightly befuddled.
Any help is appreciated.