Up

NSObject class reference

Authors

Andrew Kachites McCallum (mccallum@gnu.ai.mit.edu)

Version: 38803

Date: 2015-07-16 02:44:15 -0600 (Thu, 16 Jul 2015)

Copyright: (C) 1995, 1996, 1998 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the NSObject class
  2. Software documentation for the NSObject(GNUstep) category
  3. Software documentation for the NSObject(NEXTSTEP) category
  4. Software documentation for the NSObject(TimedPerformers) informal protocol
  5. Software documentation for the NSCoding protocol
  6. Software documentation for the NSCopying protocol
  7. Software documentation for the NSDiscardableContent protocol
  8. Software documentation for the NSMutableCopying protocol
  9. Software documentation for the NSObject protocol

Software documentation for the NSObject class

NSObject

Declared in:
Foundation/NSObject.h
Conforms to:
NSObject
Availability: OpenStep

NSObject is the root class (a root class is a class with no superclass) of the GNUstep base library class hierarchy, so all classes normally inherit from NSObject. There is an exception though: NSProxy (which is used for remote messaging) does not inherit from NSObject.

Unless you are really sure of what you are doing, all your own classes should inherit (directly or indirectly) from NSObject (or in special cases from NSProxy). NSObject provides the basic common functionality shared by all GNUstep classes and objects.

The essential methods which must be implemented by all classes for their instances to be usable within GNUstep are declared in a separate protocol, which is the NSObject protocol. Both NSObject and NSProxy conform to this protocol, which means all objects in a GNUstep application will conform to this protocol (btw, if you don't find a method of NSObject you are looking for in this documentation, make sure you also look into the documentation for the NSObject protocol).

Theoretically, in special cases you might need to implement a new root class. If you do, you need to make sure that your root class conforms (at least) to the NSObject protocol, otherwise it will not interact correctly with the GNUstep framework. Said that, I must note that I have never seen a case in which a new root class is needed.

NSObject is a root class, which implies that instance methods of NSObject are treated in a special way by the Objective-C runtime. This is an exception to the normal way messaging works with class and instance methods: if the Objective-C runtime can't find a class method for a class object, as a last resort it looks for an instance method of the root class with the same name, and executes it if it finds it. This means that instance methods of the root class (such as NSObject) can be performed by class objects which inherit from that root class ! This can only happen if the class doesn't have a class method with the same name, otherwise that method - of course - takes the precedence. Because of this exception, NSObject 's instance methods are written in such a way that they work both on NSObject 's instances and on class objects.


Instance Variables

Method summary

alloc 

+ (id) alloc;
Availability: OpenStep

Allocates a new instance of the receiver from the default zone, by invoking +allocWithZone: with NSDefaultMallocZone() as the zone argument.
Returns the created instance.

allocWithZone: 

+ (id) allocWithZone: (NSZone*)z;
Availability: OpenStep

This is the basic method to create a new instance. It allocates a new instance of the receiver from the specified memory zone.

Memory for an instance of the receiver is allocated; a pointer to this newly created instance is returned. All instance variables are set to 0. No initialization of the instance is performed apart from setup to be an instance of the correct class: it is your responsibility to initialize the instance by calling an appropriate init method. If you are not using the garbage collector, it is also your responsibility to make sure the returned instance is destroyed when you finish using it, by calling the release method to destroy the instance directly, or by using autorelease and autorelease pools.

You do not normally need to override this method in subclasses, unless you are implementing a class which for some reasons silently allocates instances of another class (this is typically needed to implement class clusters and similar design schemes).

If you have turned on debugging of object allocation (by calling the GSDebugAllocationActive function), this method will also update the various debugging counts and monitors of allocated objects, which you can access using the GSDebugAllocation... functions.


class 

+ (Class) class;
Availability: OpenStep

Returns the receiver.

initialize 

+ (void) initialize;
Availability: OpenStep

This message is automatically sent to a class by the runtime. It is sent once for each class, just before the class is used for the first time (excluding any automatic call to +load by the runtime).
The message is sent in a thread-safe manner... other threads may not call methods of the class until +initialize has finished executing.
If the class has a superclass, its implementation of +initialize is called first.
If the class does not implement +initialize then the implementation in the closest superclass may be called. This means that +initialize may be called more than once, and the recommended way to handle this by using the if (self == [classname class]) conditional to check whether the method is being called for a subclass.
You should never call +initialize yourself... let the runtime do it.
You can implement +initialize in your own class if you need to. NSObject's implementation handles essential root object and base library initialization.
It should be safe to call [super initialize] in your implementation of +initialize .

instanceMethodForSelector: 

+ (IMP) instanceMethodForSelector: (SEL)aSelector;
Availability: OpenStep

Returns a pointer to the C function implementing the method used to respond to messages with aSelector by instances of the receiving class.
Raises NSInvalidArgumentException if given a null selector.

instanceMethodSignatureForSelector: 

+ (NSMethodSignature*) instanceMethodSignatureForSelector: (SEL)aSelector;
Availability: OpenStep

Returns a pointer to the C function implementing the method used to respond to messages with aSelector which are sent to instances of the receiving class.
Raises NSInvalidArgumentException if given a null selector.

instancesRespondToSelector: 

+ (BOOL) instancesRespondToSelector: (SEL)aSelector;
Availability: OpenStep

Returns a flag to say if instances of the receiver class will respond to the specified selector. This ignores situations where a subclass implements -forwardInvocation: to respond to selectors not normally handled... in these cases the subclass may override this method to handle it.
If given a null selector, raises NSInvalidArgumentException when in MacOS-X compatibility more, or returns NO otherwise.

isSubclassOfClass: 

+ (BOOL) isSubclassOfClass: (Class)aClass;
Availability: OpenStep

Returns YES if the receiver is aClass or a subclass of aClass.

load 

+ (void) load;
Availability: OpenStep

This method is automatically invoked on any class which implements it when the class is loaded into the runtime.
It is also invoked on any category where the method is implemented when that category is loaded into the runtime.
The +load method is called directly by the runtime and you should never send a +load message to a class yourself.
This method is called before the +initialize message is sent to the class, so you cannot depend on class initialisation having been performed, or upon other classes existing (apart from superclasses of the receiver, since +load is called on superclasses before it is called on their subclasses).
As a gross generalisation, it is safe to use C code, including most ObjectiveC runtime functions within +load , but attempting to send messages to ObjectiveC objects is likely to fail.
In GNUstep, this method is implemented for NSObject to perform some initialisation for the base library.
If you implement +load for a class, don't call [super load] in your implementation.

new 

+ (id) new;
Availability: OpenStep

This method is a short-hand for alloc followed by init, that is,

NSObject *object = [NSObject new];

is exactly the same as

NSObject *object = [[NSObject alloc] init];

This is a general convention: all new... methods are supposed to return a newly allocated and initialized instance, as would be generated by an alloc method followed by a corresponding init... method. Please note that if you are not using a garbage collector, this means that instances generated by the new... methods are not autoreleased, that is, you are responsible for releasing (autoreleasing) the instances yourself. So when you use new you typically do something like:

NSMutableArray *array = AUTORELEASE ([NSMutableArray new]);

You do not normally need to override new in subclasses, because if you override init (and optionally allocWithZone: if you really need), new will automatically use your subclass methods.

You might need instead to define new new... methods specific to your subclass to match any init... specific to your subclass. For example, if your subclass defines an instance method

initWithName:

it might be handy for you to have a class method

newWithName:

which combines alloc and initWithName:. You would implement it as follows:

+ (id) newWithName: (NSString *)aName {return [[self alloc] initWithName: aName];}


poseAsClass: 

+ (void) poseAsClass: (Class)aClassObject;
Availability: OpenStep

Sets up the ObjC runtime so that the receiver is used wherever code calls for aClassObject to be used.

resolveClassMethod: 

+ (BOOL) resolveClassMethod: (SEL)name;
Availability: MacOS-X 10.5.0

This method will be called when attempting to send a message a class that does not understand it. The class may install a new method for the given selector and return YES, otherwise it should return NO. Note: This method is only reliable when using the GNUstep runtime. If you require compatibility with the GCC runtime, you must also implement -forwardInvocation: with equivalent semantics. This will be considerably slower, but more portable.

resolveInstanceMethod: 

+ (BOOL) resolveInstanceMethod: (SEL)name;
Availability: MacOS-X 10.5.0

This method will be called when attempting to send a message an instance that does not understand it. The class may install a new method for the given selector and return YES, otherwise it should return NO. Note: This method is only reliable when using the GNUstep runtime. If you require compatibility with the GCC runtime, you must also implement -forwardInvocation: with equivalent semantics. This will be considerably slower, but more portable.

setVersion: 

+ (id) setVersion: (NSInteger)aVersion;
Availability: OpenStep

Sets the version number of the receiving class. Should be nonnegative.

version 

+ (NSInteger) version;
Availability: OpenStep

Returns the version number of the receiving class. This will default to a number assigned by the Objective C compiler if [NSObject -setVersion] has not been called.

autoContentAccessingProxy 

- (id) autoContentAccessingProxy;
Availability: MacOS-X 10.6.0

Returns an auto-accessing proxy for the given object. This proxy sends a -beginContentAccess message to the receiver when it is created and an -endContentAccess message when it is destroyed. This prevents an object that implements the NSDiscardableContent protocol from having its contents discarded for as long as the proxy exists. On systems using the GNUstep runtime, messages send to the proxy will be slightly slower than direct messages. With the GCC runtime, they will be approximately two orders of magnitude slower. The GNUstep runtime, therefore, is strongly recommended for code calling this method.

awakeAfterUsingCoder: 

- (id) awakeAfterUsingCoder: (NSCoder*)aDecoder;
Availability: OpenStep

Called after the receiver has been created by decoding some sort of archive. Returns self. Subclasses may override this to perform some special initialisation upon being decoded.

classForArchiver 

- (Class) classForArchiver;
Availability: OpenStep

Override to substitute class when an instance is being archived by an NSArchiver . Default implementation returns -classForCoder .

classForCoder 

- (Class) classForCoder;
Availability: OpenStep

Override to substitute class when an instance is being serialized by an NSCoder . Default implementation returns [self class] (no substitution).

className 

- (NSString*) className;
Availability: MacOS-X 10.0.0

Returns the name of the class of the receiving object by using the NSStringFromClass() function.
This is a MacOS-X addition for apple scripting, which is also generally useful.

copy 

- (id) copy;
Availability: OpenStep

Creates and returns a copy of the receiver by calling -copyWithZone: passing NSDefaultMallocZone()

dealloc 

- (void) dealloc;
Availability: OpenStep

Deallocates the receiver by calling NSDeallocateObject() with self as the argument.

You should normally call the superclass implementation of this method when you override it in a subclass, or the memory occupied by your object will not be released.

NSObject 's implementation of this method destroys the receiver, by returning the memory allocated to the receiver to the system. After this method has been called on an instance, you must not refer the instance in any way, because it does not exist any longer. If you do, it is a bug and your program might even crash with a segmentation fault.

If you have turned on the debugging facilities for instance allocation, NSObject 's implementation of this method will also update the various counts and monitors of allocated instances (see the GSDebugAllocation... functions for more info).

Normally you are supposed to manage the memory taken by objects by using the high level interface provided by the retain, release and autorelease methods (or better by the corresponding macros RETAIN, RELEASE and AUTORELEASE), and by autorelease pools and such; whenever the release/autorelease mechanism determines that an object is no longer needed (which happens when its retain count reaches 0), it will call the dealloc method to actually deallocate the object. This means that normally, you should not need to call dealloc directly as the gnustep base library automatically calls it for you when the retain count of an object reaches 0.

Because the dealloc method will be called when an instance is being destroyed, if instances of your subclass use objects or resources (as it happens for most useful classes), you must override dealloc in subclasses to release all objects and resources which are used by the instance, otherwise these objects and resources would be leaked. In the subclass implementation, you should first release all your subclass specific objects and resources, and then invoke super's implementation (which will do the same, and so on up in the class hierarchy to NSObject 's implementation, which finally destroys the object). Here is an example of the implementation of dealloc for a subclass whose instances have a single instance variable name which needs to be released when an instance is deallocated:

- (void) dealloc {RELEASE (name); [super dealloc];}

dealloc might contain code to release not only objects, but also other resources, such as open files, network connections, raw memory allocated in other ways, etc.

If you have allocated the memory using a non-standard mechanism, you will not call the superclass (NSObject) implementation of the method as you will need to handle the deallocation specially.
In some circumstances, an object may wish to prevent itself from being deallocated, it can do this simply be refraining from calling the superclass implementation.


doesNotRecognizeSelector: 

- (void) doesNotRecognizeSelector: (SEL)aSelector;
Availability: OpenStep

Raises an invalid argument exception providing information about the receivers inability to handle aSelector.

finalize 

- (void) finalize;
Availability: MacOS-X 10.5.0

On a system which performs garbage collection, you should implement this method to execute code when the receiver is collected.
You must not call this method yourself (except when a subclass calls the superclass method within its own implementation).

forwardInvocation: 

- (void) forwardInvocation: (NSInvocation*)anInvocation;
Availability: OpenStep

This method is called automatically to handle a message sent to the receiver for which the receivers class has no method.
The default implementation calls -doesNotRecognizeSelector:

forwardingTargetForSelector: 

- (id) forwardingTargetForSelector: (SEL)aSelector;
Availability: MacOS-X 10.6.0

If an object does not understand a message, it may delegate it to another object. Returning nil indicates that forwarding should not take place. The default implementation of this returns nil, but care should be taken when subclassing NSObject subclasses and overriding this method that the superclass implementation is called if returning nil. Note: This method is only reliable when using the GNUstep runtime and code compiled with clang. If you require compatibility with GCC and the GCC runtime, you must also implement -forwardInvocation: with equivalent semantics. This will be considerably slower, but more portable.

init 

- (id) init;
Availability: OpenStep

Initialises the receiver... the NSObject implementation simply returns self.

methodForSelector: 

- (IMP) methodForSelector: (SEL)aSelector;
Availability: OpenStep

Returns a pointer to the C function implementing the method used to respond to messages with aSelector.
Raises NSInvalidArgumentException if given a null selector.

methodSignatureForSelector: 

- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector;
Availability: OpenStep

Returns the method signature describing how the receiver would handle a message with aSelector.
Returns nil if given a null selector.

mutableCopy 

- (id) mutableCopy;
Availability: OpenStep

Creates and returns a mutable copy of the receiver by calling -mutableCopyWithZone: passing NSDefaultMallocZone() .

replacementObjectForArchiver: 

- (id) replacementObjectForArchiver: (NSArchiver*)anArchiver;
Availability: OpenStep

Override to substitute another object for this instance when being archived by given NSArchiver . Default implementation returns -replacementObjectForCoder: .

replacementObjectForCoder: 

- (id) replacementObjectForCoder: (NSCoder*)anEncoder;
Availability: OpenStep

Override to substitute another object for this instance when being serialized by given NSCoder . Default implementation returns self.

superclass 

- (Class) superclass;
Availability: OpenStep

Returns the super class from which the receivers class was derived.



Instance Variables for NSObject Class

isa

@protected Class isa;
Availability: OpenStep

Points to instance's class. Used by runtime to access method implementations, etc.. Set in +alloc , Unlike other instance variables, which are cleared there.




Software documentation for the NSObject(GNUstep) category

NSObject(GNUstep)

Declared in:
Foundation/NSObject.h
Availability: Not in OpenStep/MacOS-X, Base Likely to be changed/moved/removed at 1.17.0

Some non-standard extensions mainly needed for backwards compatibility and internal utility reasons.
Method summary

enableDoubleReleaseCheck: 

+ (void) enableDoubleReleaseCheck: (BOOL)enable;
Availability: Not in OpenStep/MacOS-X, Base Likely to be changed/moved/removed at 1.17.0

Enables runtime checking of retain/release/autorelease operations.

Whenever either -autorelease or -release is called, the contents of any autorelease pools will be checked to see if there are more outstanding release operations than the objects retain count. In which case an exception is raised to say that the object is released too many times.

Beware, since this feature entails examining all active autorelease pools every time an object is released or autoreleased, it can cause a massive performance degradation... it should only be enabled for debugging.

When you are having memory allocation problems, it may make more sense to look at the memory allocation debugging functions documented in NSDebug.h, or use the NSZombie features.


Software documentation for the NSObject(NEXTSTEP) category

NSObject(NEXTSTEP)

Declared in:
Foundation/NSObject.h
Availability: Not in OpenStep/MacOS-X

Methods for compatibility with the NEXTSTEP (pre-OpenStep) 'Object' class.
Method summary

error: ,...

- (id) error: (const char*)aString,...;
Availability: Not in OpenStep/MacOS-X

Logs a message. Deprecated. Use NSLog() in new code.

Software documentation for the NSObject(TimedPerformers) informal protocol

NSObject(TimedPerformers)

Declared in:
Foundation/NSObject.h
Availability: OpenStep

Declares some methods for sending messages to self after a fixed delay. (These methods are in OpenStep and OS X.)
Method summary

cancelPreviousPerformRequestsWithTarget: 

+ (void) cancelPreviousPerformRequestsWithTarget: (id)obj;
Availability: OpenStep

Cancels any perform operations set up for the specified target in the current run loop.

cancelPreviousPerformRequestsWithTarget: selector: object: 

+ (void) cancelPreviousPerformRequestsWithTarget: (id)obj selector: (SEL)s object: (id)arg;
Availability: OpenStep

Cancels any perform operations set up for the specified target in the current loop, but only if the value of aSelector and argument with which the performs were set up match those supplied.
Matching of the argument may be either by pointer equality or by use of the [NSObject -isEqual:] method.

performSelector: withObject: afterDelay: 

- (void) performSelector: (SEL)s withObject: (id)arg afterDelay: (NSTimeInterval)seconds;
Availability: OpenStep

Sets given message to be sent to this instance after given delay, in any run loop mode. See NSRunLoop .

performSelector: withObject: afterDelay: inModes: 

- (void) performSelector: (SEL)s withObject: (id)arg afterDelay: (NSTimeInterval)seconds inModes: (NSArray*)modes;
Availability: OpenStep

Sets given message to be sent to this instance after given delay, in given run loop modes. See NSRunLoop .

Software documentation for the NSCoding protocol

NSCoding

Declared in:
Foundation/NSObject.h
Availability: OpenStep

This protocol must be adopted by any class wishing to support saving and restoring instances to an archive, or copying them to remote processes via the Distributed Objects mechanism.
Method summary

encodeWithCoder: 

- (void) encodeWithCoder: (NSCoder*)aCoder;
Availability: OpenStep

Called when it is time for receiver to be serialized for writing to an archive or network connection. Receiver should record all of its instance variables using methods on aCoder. See documentation for NSCoder , NSArchiver , NSKeyedArchiver , and/or NSPortCoder for more information.

initWithCoder: 

- (id) initWithCoder: (NSCoder*)aDecoder;
Availability: OpenStep

Called on a freshly allocated receiver when it is time to reconstitute from serialized bytes in an archive or from a network connection. Receiver should load all of its instance variables using methods on aCoder. See documentation for NSCoder , NSUnarchiver , NSKeyedUnarchiver , and/or NSPortCoder for more information.

Software documentation for the NSCopying protocol

NSCopying

Declared in:
Foundation/NSObject.h
Availability: OpenStep

This protocol must be adopted by any class wishing to support copying - ie where instances of the class should be able to create new instances which are copies of the original and, where a class has mutable and immutable versions, where the copies are immutable.
Method summary

copyWithZone: 

- (id) copyWithZone: (NSZone*)zone;
Availability: OpenStep

Called by [NSObject -copy] passing NSDefaultMallocZone() as zone.
This method returns a copy of the receiver and, where the receiver is a mutable variant of a class which has an immutable partner class, the object returned is an instance of that immutable class.
The new object is not autoreleased, and is considered to be 'owned' by the calling code... which is therefore responsible for releasing it.
In the case where the receiver is an instance of a container class, it is undefined whether contained objects are merely retained in the new copy, or are themselves copied, or whether some other mechanism entirely is used.

Software documentation for the NSDiscardableContent protocol

NSDiscardableContent

Declared in:
Foundation/NSObject.h
Availability: MacOS-X 10.6.0

The NSDiscardableContent protocol is used by objects which encapsulate data which may be discarded if resource constraints are exceeded. These constraints are typically, but not always, related memory.
Method summary

beginContentAccess 

- (BOOL) beginContentAccess;
Availability: MacOS-X 10.6.0

This method is called before any access to the object. It returns YES if the object's content is still valid. The caller must call -endContentAccess once for every call to -beginContentAccess ;

discardContentIfPossible 

- (void) discardContentIfPossible;
Availability: MacOS-X 10.6.0

Discards the contents of the object if it is not currently being edited.

endContentAccess 

- (void) endContentAccess;
Availability: MacOS-X 10.6.0

This method indicates that the caller has finished accessing the contents of the object adopting this protocol. Every call to -beginContentAccess must be be paired with a call to this method after the caller has finished accessing the contents.

isContentDiscarded 

- (BOOL) isContentDiscarded;
Availability: MacOS-X 10.6.0

Returns YES if the contents of the object have been discarded, either via a call to -discardContentIfPossible while the object is not in use, or by some implementation dependent mechanism.

Software documentation for the NSMutableCopying protocol

NSMutableCopying

Declared in:
Foundation/NSObject.h
Availability: OpenStep

This protocol must be adopted by any class wishing to support mutable copying - ie where instances of the class should be able to create mutable copies of themselves.
Method summary

mutableCopyWithZone: 

- (id) mutableCopyWithZone: (NSZone*)zone;
Availability: OpenStep

Called by [NSObject -mutableCopy] passing NSDefaultMallocZone() as zone.
This method returns a copy of the receiver and, where the receiver is an immutable variant of a class which has a mutable partner class, the object returned is an instance of that mutable class. The new object is not autoreleased, and is considered to be 'owned' by the calling code... which is therefore responsible for releasing it.
In the case where the receiver is an instance of a container class, it is undefined whether contained objects are merely retained in the new copy, or are themselves copied, or whether some other mechanism entirely is used.

Software documentation for the NSObject protocol

NSObject

Declared in:
Foundation/NSObject.h
Availability: OpenStep

The NSObject protocol describes a minimal set of methods that all objects are expected to support. You should be able to send any of the messages listed in this protocol to an object, and be safe in assuming that the receiver can handle it.
Method summary

autorelease 

- (id) autorelease;
Availability: OpenStep

Performs a deferred -release operation. The object's reference count is decremented at the end of the scope of the current autorelease pool, identified either by a -drain message sent to the current NSAutoreleasePool instance, or in more recent versions of Objective-C by the end of an @autorelease_pool scope. In garbage collected mode, this method does nothing. In automated reference counting mode, you may neither implement this method nor call it directly.

class 

- (Class) class;
Availability: OpenStep

Returns the class of the receiver. If the receiver is a proxy, then this may return the class of the proxy target. Use -isProxy to determine whether the receiver is a proxy. If you wish to find the real class of the receiver, ignoring proxies, then use object_getClass() .

conformsToProtocol: 

- (BOOL) conformsToProtocol: (Protocol*)aProtocol;
Availability: OpenStep

Returns YES if the receiver conforms to the specified protocol.

description 

- (NSString*) description;
Availability: OpenStep

Returns the description of the object. This is used by the %@ format specifier in strings.

hash 

- (NSUInteger) hash;
Availability: OpenStep

Returns a hash value for the object. All objects that are equal *MUST* return the same hash value. For efficient storage in sets, or as keys in dictionaries, different objects should return hashes spread evenly over the range of an integer. An object may not return different values from this method after being stored in a collection. This typically means that ether the hash value must be constant after the object's creation, or that the object may not be modified while stored in an unordered collection.

isEqual: 

- (BOOL) isEqual: (id)anObject;
Availability: OpenStep

Returns whether the receiver is equal to the argument. Defining equality is complex, so be careful when implementing this method. Collections such as NSSet depend on the behaviour of this method. In particular, this method must be commutative, so for any objects a and b: [a isEqual: b] == [b isEqual: a] This means that you must be very careful when returning YES if the argument is of another class. For example, if you define a number class that returns YES if the argument is a string representation of the number, then this will break because the string will not recognise your object as being equal to itself. If two objects are equal, then they must have the same hash value, however equal hash values do not imply equality.

isKindOfClass: 

- (BOOL) isKindOfClass: (Class)aClass;
Availability: OpenStep

Returns YES if the receiver is an instance of the class, an instance of the subclass, or (in the case of proxies), an instance of something that can be treated as an instance of the class.

isMemberOfClass: 

- (BOOL) isMemberOfClass: (Class)aClass;
Availability: OpenStep

Returns YES if the receiver is an instance of the class or (in the case of proxies), an instance of something that can be treated as an instance of the class. Calling this method is rarely the correct thing to do. In most cases, a subclass can be substituted for a superclass, so you should never need to check that an object is really an instance of a specific class and not a subclass.

isProxy 

- (BOOL) isProxy;
Availability: OpenStep

Returns YES if the receiver is a proxy, NO otherwise. The default implementation of this method in NSObject returns NO, while the implementation in NSProxy returns YES.

performSelector: 

- (id) performSelector: (SEL)aSelector;
Availability: OpenStep

Performs the specified selector. The selector must correspond to a method that takes no arguments.

performSelector: withObject: 

- (id) performSelector: (SEL)aSelector withObject: (id)anObject;
Availability: OpenStep

Performs the specified selector, with the object as the argument. This method does not perform any automatic unboxing, so the selector must correspond to a method that takes one object argument.

performSelector: withObject: withObject: 

- (id) performSelector: (SEL)aSelector withObject: (id)object1 withObject: (id)object2;
Availability: OpenStep

Performs the specified selector, with the objects as the arguments. This method does not perform any automatic unboxing, so the selector must correspond to a method that takes two object arguments.

release 

- (oneway void) release;
Availability: OpenStep

Decrements the reference count of the object and destroys if it there are no remaining references. In garbage collected mode, this method does nothing. In automated reference counting mode, you may neither implement this method nor call it directly.

respondsToSelector: 

- (BOOL) respondsToSelector: (SEL)aSelector;
Availability: OpenStep

Returns YES if the object can respond to messages with the specified selector. The default implementation in NSObject returns YES if the receiver has a method corresponding to the method, but other classes may return YES if they can respond to a selector using one of the various forwarding mechanisms.

retain 

- (id) retain;
Availability: OpenStep

Increments the reference count of the object and returns the receiver. In garbage collected mode, this method does nothing. In automated reference counting mode, you may neither implement this method nor call it directly.

retainCount 

- (NSUInteger) retainCount;
Availability: OpenStep

Returns the current retain count of an object. This does not include the result of any pending autorelease operations. Code that relies on this method returning a sane value is broken. For singletons, it may return NSUIntegerMax. Even when it is tracking a retain count, it will not include on-stack pointers in manual retain/release mode, pointers marked as __unsafe_unretain or __weak in ARC mode, or pending autorelease operations. Its value is therefore largely meaningless. It can occasionally be useful for debugging.

self 

- (id) self;
Availability: OpenStep

Returns the receiver. In a proxy, this may (but is not required to) return the proxied object.

superclass 

- (Class) superclass;
Availability: OpenStep

Returns the superclass of receiver's class. If the receiver is a proxy, then this may return the class of the proxy target. Use -isProxy to determine whether the receiver is a proxy. If you wish to find the real superclass of the receiver's class, ignoring proxies, then use class_getSuperclass(object_getClass()).

zone 

- (NSZone*) zone;
Availability: OpenStep

Returns the zone of the object.


Up