I have this problem before in my code, and let me guess, you have created the array in your "init" or "initWith...." method, right?
To properly create a property with code (that is, not a UI control from Interface Builder) in "init" method, *always* retain your property.
In short,
myNSMutableArray = [[NSMutableArray alloc] initWith....];
should be
myNSMutableArray = [[[NSMutableArray alloc] initWith....] retain];
this way, even your "init" method ends, the retain count of "myNSMutableArray" will prevent the system to free/release your object.
Alternatively, since you declare the property in (retain) way, you can use
self.myNSMutableArray = [[NSMutableArray alloc] initWith...];
Using accessor will do the retain for you.
|