What is the difference between retain & assign?
Ask by Tarun Kumar
Updated 24 Sep 2020
if (obj1 != ob2) {[obj1 release];
obj1 = nil;
obj1 = obj2; }
Retain creates a reference from one object to another and increases the retain count of the source object.
if (obj1 != obj2) {[obj1 release];
obj1 = nil;
obj1 = [obj2 retain]; }