I declare my array in my *.h file:
@interface aViewController: UIViewController
{
NSMutableArray *anArray; // You will need to later change this many times.
}
@end
I alloc memory for it my *.m file:
-(void) viewDidLoad
{
anArray = [[NSMutableArray alloc] init];
}
I click a test-button to load my array (eventually it will need to load DIFFERNT values on each click):
anArray = [NSMutableArray arrayWithObjects:@"one", @"two", @"three", nil];
And I free it here:
-(void) dealloc
{
[anArray release];
[super dealloc];
}
Does that all look ok?
Because it crashes when I later run this code:
NSLog(@"%d", [anArray count]);
Not sure why a simple "NSLog() and count" would crash everything.