NSXPCInterface Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in OS X v10.8 and later.
Declared in
NSXPCConnection.h
Related sample code

Overview

Class that describes the methods that may be sent to an exported object or remote object proxy.

This object holds all information about the interface of an exported object or remote object proxy. It describes what messages are allowed, what kinds of objects are allowed as arguments, what the signature of any reply blocks are, and information about additional proxy objects.

Tasks

Miscellaneous

Properties

protocol

The Objective-C protocol that this interface is based on.

@property (assign) Protocol *protocol;
Availability
  • Available in OS X v10.8 and later.
Declared In
NSXPCConnection.h

Class Methods

interfaceWithProtocol:

Returns an NSXPCInterface instance for a given protocol.

+ (NSXPCInterface *)interfaceWithProtocol:(Protocol *)protocol;
Discussion

Most interfaces do not need any further configuration. Interfaces with collection classes or additional proxy objects should be configured using the other methods in this class.

Availability
  • Available in OS X v10.8 and later.
Declared In
NSXPCConnection.h

Instance Methods

classesForSelector:argumentIndex:ofReply:

Returns the current list of allowed classes that can appear within the specified collection object argument to the specified method.

- (NSSet *)classesForSelector:(SEL)sel argumentIndex:(NSUInteger)arg ofReply:(BOOL)ofReply;
Parameters
sel

Specifies which method in the protocol you want information about.

arg

Specifies the position (starting at index 0) of the parameter for which you want to obtain the current set of allowed classes. This may be either the position of a parameter in the method itself or the position in its reply block.

ofReply

Pass YES if arg is an index into the parameters of the reply block, or NO if it is an index into the parameters of the method itself.

Discussion

See setClasses:forSelector:argumentIndex:ofReply: for more explanation.

Availability
  • Available in OS X v10.8 and later.
Declared In
NSXPCConnection.h

interfaceForSelector:argumentIndex:ofReply:

Returns the interface previously set for the specified selector and parameter.

- (NSXPCInterface *)interfaceForSelector:(SEL)sel argumentIndex:(NSUInteger)arg ofReply:(BOOL)ofReply;
Parameters
sel

Specifies which method in the protocol you want information about.

arg

Specifies the position (starting at index 0) of the parameter for which you want to obtain the current interface. This may be either the position of a parameter in the method itself or the position in its reply block.

ofReply

Pass YES if arg is an index into the parameters of the reply block, or NO if it is an index into the parameters of the method itself.

Discussion

See setInterface:forSelector:argumentIndex:ofReply: for more explanation.

Availability
  • Available in OS X v10.8 and later.
Declared In
NSXPCConnection.h

setClasses:forSelector:argumentIndex:ofReply:

Sets the classes that can appear within the (numerically) specified collection object argument to the specified method.

- (void)setClasses:(NSSet *)classes forSelector:(SEL)sel argumentIndex:(NSUInteger)arg ofReply:(BOOL)ofReply;
Parameters
classes

An NSSet containing Class objects—for example, [MyObject class].

sel

Specifies which method in the protocol is being configured.

arg

Specifies the position (starting at index 0) of the parameter for which you are allowing classes. This may be either the position of a parameter in the method itself or the position in its reply block.

ofReply

Pass YES if arg is an index into the parameters of the reply block, or NO if it is an index into the parameters of the method itself.

Discussion

If an argument to a method in your protocol is a collection class (for example, NSArray or NSDictionary), then you must explicitly specify the set of expected classes that may appear within that collection.

If the expected classes are all property list types, calling this method is optional; property list types are allowed by default inside collection objects. You may, however, call this method to further restrict the set of allowed classes.

Availability
  • Available in OS X v10.8 and later.
Declared In
NSXPCConnection.h

setInterface:forSelector:argumentIndex:ofReply:

Configures a specific parameter of a method to be sent as a proxy object instead of copied.

- (void)setInterface:(NSXPCInterface *)ifc forSelector:(SEL)sel argumentIndex:(NSUInteger)arg ofReply:(BOOL)ofReply;
Parameters
ifc

The NSXPCInterface object that describes the protocol for the proxy object. The interface is configured the same way as the interface for an exported object or remote object proxy.

sel

Specifies which method in the protocol is being configured.

arg

Specifies the position (starting at index 0) of the parameter for which you are configuring a proxy object. This may be either the position of a parameter in the method itself or the position in its reply block. This argument must be an object.

ofReply

Pass YES if arg is an index into the parameters of the reply block, or NO if it is an index into the parameters of the method itself.

Discussion

If an argument to a method in your protocol should be sent as a proxy object instead of by copy, then configure the interface for that protocol with a new interface for a specific argument. An example of an object that should be a proxy instead of being copied is a view object.

Availability
  • Available in OS X v10.8 and later.
Declared In
NSXPCConnection.h