O'Reilly logo

iPhone Applications Tune-Up by Loyal Moses

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

Release

An NSObject instance method, release decrements the reference count of the receiving object by 1.

Calling a method on an object with a retain count of zero will cause an application to crash. In my experience, this is one of the more common mistakes that developers make in Objective-C. Developers simply losing track of an object's retain count and over, and calling the release method, which ultimately crashes the application.

If you are not yet familiar with over-releasing an object, the result as mentioned previously is a sudden crash that at times can be difficult to locate, especially when dealing with autorelease objects that live until the end of the event cycle, which we'll touch upon later.

Knowing when and where to release an object ...

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