Next time, stick your code in your question, not the comment. Here it is nicely formatted:
NSMutableArray *currentIngsGroup = [[NSMutableArray alloc] init];
currentIngsGroup = (NSMutableArray *)[allIngredientGroups objectAtIndex:0];
NSLog(@"accesing array %d", [currentIngsGroup count]);
Normally, I would say that the symptom you describe indicates that you are over-releasing something. The code, though, demonstrates a fundamental lack of understanding of Objective-C. I would suggest reading the Introduction to Objective-C document.
In particular, you are allocating an instance of NSMutableArray in the first line of code. The second line, though, immediately overwrites the mutable array reference with a reference to whatever object is at index 0 of the allIngredientGroups
array.
The (NSMutableArray *)
is totally unnecessary. It won't force whatever object is in the array to be a mutable array and, since -objectAtIndex:
returns an (id)
a cast isn't necessary.
BTW: The array allocated on the first line is being leaked. Again, read the introduction to objective-c to understand why.