Contents

initWithTarget:connection:

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

Declaration

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

Parameters

  • target:

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

  • connection:

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

Return Value

An NSDistantObject object initialized as a remote proxy for target. If a proxy for target and connection 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 target 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