O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

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

Name

NSCoder — Mac OS X 10.0

Synopsis

This class defines an abstract interface for subclasses that implement object archival functionality. The Foundation framework implements five concreate subclasses: NSArchiver and NSUnarchiver are used for non-keyed archiving, while NSKeyedArchiver and NSKeyedUnarchiver provide support for keyed-archiving. NSPortCoder is used by the distributed objects system to send object proxies across a connection. For more information, see the class references for these five classes, the protocol reference for the NSCoding protocol, and Chapter 2.

image with no caption

@interface NSCoder : NSObject
                                  // Accessor Methods
   - (void)setObjectZone:(NSZone *)zone;
   - (NSZone *)objectZone;
                                  // Instance Methods
   - (BOOL)allowsKeyedCoding;
   - (void)decodeArrayOfObjCType:(const char *)itemType 
                                 count:(unsigned)count 
                                 at:(void *)array;
   - (BOOL)decodeBoolForKey:(NSString *)key;
   - (const uint8_t *)decodeBytesForKey:(NSString *)key 
                                 returnedLength:(unsigned *)lengthp;
   - (void *)decodeBytesWithReturnedLength:(unsigned *)lengthp;
   - (NSData *)decodeDataObject;
   - (double)decodeDoubleForKey:(NSString *)key;
   - (float)decodeFloatForKey:(NSString *)key;
   - (int32_t)decodeInt32ForKey:(NSString *)key;
   - (int64_t)decodeInt64ForKey:(NSString *)key;
   - (int)decodeIntForKey:(NSString *)key;
   - (NSColor *)decodeNXColor;
   - (id)decodeNXObject;
   - (id)decodeObject;
   - (id)decodeObjectForKey ...

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