Today i was overwriting -(NSString*)description method and i wondered if need to autorelease this string before returning it.
-(NSString*)description {
NSMutableString *response = [[NSMutableString alloc] init];
// perform appends
return [response autorelease];
}
Yes, as per ownership rule your function must not delegate the ownership of the returned string to the caller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With