Friday, July 1, 2011

How to set new object properly in objective C

create new object without memory leak.


AnyObject *myObject = [[AnyObject alloc] init]; 
something.property = myObject;
[myObject release]; // no leaks!