When trying to read values from my nsmutablearray, it errors with EXC_BAD_ACCESS
I believe I have loaded the array correctly in my init statement:
During init i call this in a separate void:
The above code works fine.
But then when I want to access it in a seperate void after it just crashes when i try to read from it, or count etc...
What is wrong with this code that is causing it to crash?
I believe I have loaded the array correctly in my init statement:
Code:
arraystore= [NSMutableArray arrayWithCapacity:10];
self.myarray = arraystore;
[arraystore release];
During init i call this in a separate void:
Code:
[self.myarray addObject:[NSValue valueWithPointer:Shape]];
NSLog(@"added %@ to Array",[self.myarray objectAtIndex:0]);
But then when I want to access it in a seperate void after it just crashes when i try to read from it, or count etc...
Code:
for(int i =0;i<[self.myarray count];i++) //crashes here
{
NSLog(@"dealing with - %@",[self.myarray objectAtIndex:i]);
}
//Or simply this :
NSLog(@"dealing with - %@",[self.myarray objectAtIndex:0]);
What is wrong with this code that is causing it to crash?