ios - When should we release an object if we are returning it? -
check following method:
-(nsmutablearray*)providerequestarray{     nsmutablearray* requestarray=[[nsmutablearray alloc] initwithobjects:@"mystring",nil];     return requestarray; } now when should requestarray released doesn't produce consequences. 
return object sending autorelease message.
// initwithformat: ?? nsmutablearray* requestarray=[[nsmutablearray alloc]                               initwithformat:@"mystring"]; return [requestarray autorelease]; or autoreleased 1 (for instance array class method) :
nsmutablearray* requestarray= [nsmutablearray array]; return requestarray; check out doc here.
Comments
Post a Comment