Protocol

NSObject

The NSObject protocol groups methods that are fundamental to all Objective-C objects.

Overview

If an object conforms to this protocol, it can be considered a first-class object. Such an object can be asked about its:

  • Class, and the place of its class in the inheritance hierarchy

  • Conformance to protocols

  • Ability to respond to a particular message

The Cocoa root class, NSObject, adopts this protocol, so all objects inheriting from NSObject have the features described by this protocol.

Symbols

Identifying Classes

class

Returns the class object for the receiver’s class.

superclass

Returns the class object for the receiver’s superclass.

Identifying and Comparing Objects

isEqual:

Returns a Boolean value that indicates whether the receiver and a given object are equal.

hash

Returns an integer that can be used as a table address in a hash table structure.

self

Returns the receiver.

Testing Object Inheritance, Behavior, and Conformance

isKindOfClass:

Returns a Boolean value that indicates whether the receiver is an instance of given class or an instance of any class that inherits from that class.

isMemberOfClass:

Returns a Boolean value that indicates whether the receiver is an instance of a given class.

respondsToSelector:

Returns a Boolean value that indicates whether the receiver implements or inherits a method that can respond to a specified message.

conformsToProtocol:

Returns a Boolean value that indicates whether the receiver conforms to a given protocol.

Describing Objects

description

Returns a string that describes the contents of the receiver.

debugDescription

Returns a string that describes the contents of the receiver for presentation in the debugger.

Sending Messages

performSelector:

Sends a specified message to the receiver and returns the result of the message.

performSelector:withObject:

Sends a message to the receiver with an object as the argument.

performSelector:withObject:withObject:

Sends a message to the receiver with two objects as arguments.

Identifying Proxies

isProxy

Returns a Boolean value that indicates whether the receiver does not descend from NSObject.

Obsolete Methods

retain

Increments the receiver’s reference count.

release

Decrements the receiver’s reference count.

autorelease

Decrements the receiver’s retain count at the end of the current autorelease pool block.

retainCount

Do not use this method.

zone

Zones are deprecated and ignored by most classes that have it as a parameter.

Relationships

Adopted By