in a header file I defined
NSMutableArray *numbers;
In the implementation I initialize this array first in the init method
numbers = [[NSMutableArray alloc] init];
I add strings to this array
[numbers insertObject:number atIndex:[numbers count]];
But when I access the array like this in another method
NSLog(@"%@", [numbers count]);
the application crashes. Any idea why this happens?
You are wrong here –
Array count is an integer value. Use %d instead of %@ to print integer.