Hi all,
I fear it my just be my tiredness, but I'm having a problem allocating an NSMutableArray, adding some custom objects to it, then returning its count. The offending code is below:
Code:
FMResultSet *rs = [db executeQuery:@"select * from categories"];
NSMutableArray *array = [[NSMutableArray alloc] init];
while ([rs next]) {
cCategory *category = [[cCategory alloc] init];
category.categoryid = [NSNumber numberWithInt:[rs intForColumn:@"categoryid"]];
category.category = [rs stringForColumn:@"category"];
NSLog(@"%@ - %@: %@", category, category.categoryid, category.category);
[array addObject:category];
[category release];
}
NSLog(@"count: %@ items", [array count]);
[array release];
The NSLog's within the while loop are called fine, so alloc/init'ing my object isn't causing the problem, and commenting out the addObject stops the app crashing. But in its state above, the final NSLog before I release the array doesn't get called because the app quits out (unfortunately with no error).
Am I being daft?
Cheers