Type Method

defaultConnection

Returns the default NSConnection object for the current thread.

Declaration

+ (NSConnection *)defaultConnection;

Return Value

The default NSConnection object for the current thread, creating it if necessary.

Discussion

The default NSConnection object uses a single NSPort object for both receiving and sending and is useful only for vending an object; use the rootObject and registerName: methods to do this.

Special Considerations

The singleton method of NSConnection has been deprecated. It was difficult to ensure that the shared connection wasn’t being used by other operations on the thread on which the default connection was requested. Using [NSConnection new] ensures that you get a unique connection object, preventing such collisions.

See Also