NSMutableArray addObject not working NSMutableArray addObject not working objective-c objective-c

NSMutableArray addObject not working


The "0x0" part is a memory address. Specifically, "nil", which means your mutable array doesn't exist at the time this is being called. Try creating it in your -init method:

categories = [[NSMutableArray alloc] init];

Don't forget to release it in your -dealloc.


Initialize an empty array using

categories = [NSMutableArray array];

The array class method are autoreleased so no need to release.