All the numeric data types we’ve dealt with up to now, such as integers, floats, and longs, are basic data types in the Objective-C language; that is, they are not objects. For example, you cannot send messages to them. Sometimes, though, you need to work with these values as objects. For example, the Foundation object
NSArray enables you to set up an array in which you can store values. These values have to be objects, so you cannot directly store any of your basic data types in these arrays. Instead, to store any of the basic numeric data types (including the
char data type), you can use the
NSNumber class to create objects from these data types (see Program 15.1).
// Working with ...