I have this code wich accepts an array of income objects from Core Data.
- (void)totalIncome:(NSMutableArray *)IncomesArray {
int i;
int total;
for (i = 0; i < [IncomesArray count]; ++i)
{
Income *income = [IncomesArray objectAtIndex:i];
total += (int)[income value];
NSLog(@"%@", total);
}
self.totalIncomes = [[NSNumber alloc] initWithInt:(int)total];
NSLog(@"%.2f", self.totalIncomes);
}
But the line NSLog(@"%@", total); causes an EXEC BAD ACCESS error. Is there something obvious I have done wrong. Also if I remove the log nothing is added to totalIncomes which is declared in my header file as a NSNumber. Thanks.