Reputation: 10172
Check the following method:
-(NSMutableArray*)provideRequestArray{
NSMutableArray* requestArray=[[NSMutableArray alloc] initWithObjects:@"MyString",nil];
return requestArray;
}
Now when should requestArray
be released so it doesn't produce any consequences.
Upvotes: 3
Views: 84
Reputation:
Return that object sending an autorelease
message.
// initWithFormat: ??
NSMutableArray* requestArray=[[NSMutableArray alloc]
initWithFormat:@"MyString"];
return [requestArray autorelease];
or get an autoreleased one (for instance with array
class method) :
NSMutableArray* requestArray= [NSMutableArray array];
return requestArray;
Check out the doc here.
Upvotes: 5