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
Required.

Returns the class object for the receiver’s class.

superclass
Required.

Returns the class object for the receiver’s superclass.

Identifying and Comparing Objects

isEqual:
Required.

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

hash
Required.

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

self
Required.

Returns the receiver.

Testing Object Inheritance, Behavior, and Conformance

isKindOfClass:
Required.

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:
Required.

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

respondsToSelector:
Required.

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

conformsToProtocol:
Required.

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

Describing Objects

description
Required.

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:
Required.

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

performSelector:withObject:
Required.

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

performSelector:withObject:withObject:
Required.

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

Identifying Proxies

isProxy
Required.

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

Obsolete Methods

retain
Required.

Increments the receiver’s reference count.

release
Required.

Decrements the receiver’s reference count.

autorelease
Required.

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

retainCount
Required.

Do not use this method.

zone
Required.

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

Relationships

Adopted By