ARC inserts a [release] call when you set the __strong variable, which references the object to nil .
@interface MyViewController : UIViewController { UIViewController *childViewController; } ... @end -(void)destroyChild { childViewController = nil; }
The same thing happens when you have an array of C-style objects: setting the element of your array to nil frees the element that was there if it was not __weak / __unsafe_unretained . If you store child controllers in an NSMutableArray , removing an object from the array reduces its number of references.
source share