I have the following variable in my .h file:
NSMutableArray *arr;
Then I have a method in implementation:
void aMethod
{
if (something)
{
arr= [[NSMutableArray alloc] init];
arr = [NSMutableArray arrayWithCapacity:0];
[arr addObject:someObject];
}
now if I try to access arr from any other method or even another if block within the same method, the app crashes and I can't access that arr. For example:
//same method:
if (something else)
{
SomeObject *obj = [arr objectAtIndex:0]; //<---- it crashes on this line
}
Any light guys? Thanks in advance