I’m a bit confused as to whether NSStrings should ever be retained and synthesized. I have a NSString value as an instance variable, and am retaining and synthesizing it. But I am assigning it different values such as:
self.value = @"VALUE";
....
self.value = @"DIFFERENT_VALUE";
I’m not actually calling alloc anytime. Do I need to retain and synthesize this variable then?
You can think of on-the-fly strings as autoreleased in terms of how you use them, although in reality they will probably stay around as fixed values… because you are using the accessors they will automatically get copied or retained (however you marked the accessor) and so you do need to release them in dealloc.
As for the need to
@synthesize,remember all that is doing for you is actually creating the get/set methods that take the variable and place it in your iVar. So not matter what you either need to@synethsizea property OR create the get/methods yourself – usually far better just to use@sythesize.