For the More Curious: manual reference counting and ARC history

As mentioned at the beginning of Chapter 21, before automatic reference counting (ARC) was added to Objective-C, you had manual reference counting, which used retain counts. With manual reference counting, ownership changes only happened when you sent an explicit message to an object that decremented or incremented the retain count.

[anObject release]; // anObject loses an owner
[anObject retain]; // anObject gains an owner

You would see these sorts of calls primarily in accessor methods (where the new value was retained and the old value was released) and in dealloc methods (where all the previously retained objects were released). The setHolder: method for BNRAsset ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.