So assume I declared an object and created a retained property for it which is synthesized. So something like that in the header file:
NSArray *array;
@property (retain)....
After it is synthesized, I called release in the dealloc.
Now in the init method, if I want to also dynamically allocate that array, what do I do in terms of releasing it? So:
array = [[NSArray alloc] initWithObjects...
How do I keep the object retained as long as the class is running without leaking?
Thank you
or
With both options, you additionally have to call
[array release];in dealloc.By using its setter method, you normally don’t have do worry about retains and releases.