-(NSArray*)getSomeStuff {
NSMutableArray *array = [[NSMutableArray alloc]init];
// Add some objects to array
return array;
}
I alloced that array, so I have to release it at some point. However, how do I release it if I need it until I return it?
Use
autorelease:It will be released later, but the caller might
retainit to take ownership.Alternatively, you could use the
arrayclass method :