English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

Intermediate iOS Development

Objective C

Although Beginning iOS Development: A Safari Tutorial covered a lot of ground in terms of Objective-C, it ignored one important area: the Objective-C runtime. Objective-C was modeled after Smalltalk, and like Smalltalk, Objective-C is a very dynamic language. This dynamic behavior results from the underlying Objective-C runtime.

Interestingly, although quite a number of changes were made to Objective-C in iOS 6, as shown in the Beginning guide, none of these changes affected the runtime.

You can make use of the runtime in three ways. The first is through the language itself. You have already seen examples of this with categories and extensions. You might not have realized it, but both of these language features rely on the runtime’s ability to add methods to existing classes. The second way to access the runtime is via the NSObject class. There are literally dozens of methods on NSObject that are little more than convenient wrappers around runtime functionality. They range from lightweight methods like isMemberOfClass and isKindOfClass, to heavyweight methods such as setValue:forKey and didChangeValueForKey. You may have already seen many of these in Kochan or Clair from the previous guide. Finally, the runtime may be accessed directly through its application programming interface (API). This section includes examples of all three routes into the runtime.

Unfortunately, the material on the Objective-C runtime tends to be scattered, which can make it hard to find. In addition, the authors do not necessarily present a given topic as part of the runtime. However, for all the difficulty in finding the material, it is worthwhile to gain an understanding of the runtime. Not only can you use it directly in your code, but it also helps you appreciate the power and elegance to be found in frameworks like Core Data and Bindings.

The following references are by no means the whole story of the Objective-C runtime. Even the official Apple documentation on the runtime is rather sketchy in areas. Then again, being aware of the runtime is half the battle. As your experience grows, and as you encounter more frameworks and other developers’ code, you will come to find that a lot of the magic of iOS and Objective-C is directly related to the runtime.


These videos really add to Chisnall’s book and should not be missed:



Don’t let the word Mac in the title keep you away. The roots of iOS were planted in the Mac, and the two platforms still share much in common.


There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.