An NSValue object serves as an object wrapper for a standard C or Objective-C data item, allowing it to be stored in a collection object such as an NSArray or NSDictionary. An NSValue object is a simple container for a single C or Objective-C data item. It can hold any of the scalar types such as int, float, and char, as well as pointers, structures, and object ids. The purpose of this class is to allow items of such data types to be added to collection objects such as NSArrays and NSSets, which require their elements to be objects.
NSValue objects are always immutable.
To create an NSValue object with a particular data item, you provide a pointer to the item along with a C string describing the item's type in Objective-C type encoding. C strings, variable-length arrays and structures, and other data types of indeterminate length can't be stored in an NSValue. You should use NSString or NSData objects for these. If you must store a variable-length item in an NSValue, you have to store a pointer to the item, not the item itself. Note that the NSValue doesn't copy the contents of the string, but the pointer itself.