Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights Reserved.

NSInvocation

Inherits From: NSObject

Conforms To: NSCoding NSObject (NSObject)

Declared In: Foundation/NSInvocation.h

Class Description

Objects of the NSInvocation class provide a system-independent means to construct message calls to other objects. An NSInvocation object constructs a target object to which a message can be sent, a selector for that method, an argument list for the selector, and a return value. NSInvocation objects provide great flexibility in that the methods, method arguments, and targets of the methods may be constructed dynamically.

The final sending of the message to the target object can be performed at any time, independent of constructing the invocation. For example, methods could be dispatched based on timer events. In addition, return values from the methods are stored in the NSInvocation object and can be retrieved at any later stage in processing.

Also see NSMethodSignature for a description of how to construct method signatures.

The Foundation/NSInvocation.h header file defines two macros that may be used as constructors for invocations:

NSInvocation *invocation = NS_MESSAGE(target, message)

builds an invocation containing a message to a known target object. target is an object id. message consists of a selector followed by any arguments, just like an Objective-C message.

NSInvocation *invocation = NS_INVOCATION(class, message)

builds an invocation containing a message to the untargeted class object class. message consists of a selector followed by any arguments, just like an Objective-C message.

Creating Invocations

Managing Invocation Arguments

Dispatching an Invocation