O'Reilly logo

Objective-C Programming: The Big Nerd Ranch Guide by Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

For the More Curious: Manual reference counting and ARC History

As mentioned at the beginning of Chapter 19, before automatic reference counting (ARC) was added to Objective-C, we 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.

[​a​n​O​b​j​e​c​t​ ​r​e​l​e​a​s​e​]​;​ ​/​/​ ​a​n​O​b​j​e​c​t​ ​l​o​s​e​s​ ​a​n​ ​o​w​n​e​r​
[​a​n​O​b​j​e​c​t​ ​r​e​t​a​i​n​]​;​ ​/​/​ ​a​n​O​b​j​e​c​t​ ​g​a​i​n​s​ ​a​n​ ​o​w​n​e​r​

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required