For example, I need to append a word to an existing string.
NSString * temp = @"some prefix";
someString = [temp stringByAppendString: someString];
Should I release the object temp?
For example, I need to append a word to an existing string.
NSString * temp = @"some prefix";
someString = [temp stringByAppendString: someString];
Should I release the object temp?
You did not call any methods containing new
, alloc
, retain
or copy
, so you do not own it, so you should not release it.
No, you shouldn't as you didn't increase retain count of @"some text".
PS: Actually, all @"..." constants have retainCount on MAX_INT, so it doesn't matter if you release them or not :).