Instance Method

initWithTarget:connection:

Initializes a newly allocated NSDistantObject as a remote proxy for remoteObject, which is an id in another thread or another application’s address space.

Declaration

- (instancetype)initWithTarget:(id)target connection:(NSConnection *)connection;

Parameters

remoteObject

An object in another thread or another application’s address space.

aConnection

The connection to set as the NSConnection object for the returned proxy—it should have been created using the NSConnectionconnectionWithRegisteredName:host: class method.

Return Value

An NSDistantObject object initialized as a remote proxy for remoteObject. If a proxy for remoteObject and aConnection already exists, the receiver is released and the existing proxy is retained and returned.

Discussion

A remote proxy can’t be used until its connection’s peer has a local proxy representing remoteObject in the other application.

This is the designated initializer for remote proxies. It returns an initialized object, which might be different than the original receiver.

See Also

Creating a Remote Proxy

+ proxyWithTarget:connection:

Returns a remote proxy for a given object and connection, creating the proxy if necessary.

Deprecated