<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.0.0 - 10.13.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSConnection/registerName:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSConnection(im)registerName:"
  },
  "title" : "registerName:"
}
-->

# registerName:

Registers the specified service using with the default system port name server.

```
- (BOOL) registerName:(NSString *) name;
```

## Parameters

`name`

The name under which to register the receiver.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the operation was successful, otherwise <doc://com.apple.documentation/documentation/Swift/false> (for example, if another `NSConnection` object on the same host is already registered under `name`).

## Discussion

This method connects the receive port of the receiving `NSConnection` object with the specified service name. It registers the name using the port name server returned by the [`systemDefaultPortNameServer`](/documentation/Foundation/NSPortNameServer/systemDefaultPortNameServer) method of `NSPortNameServer`. If the operation is successful, other `NSConnection` objects can contact the receiver using the [`connectionWithRegisteredName:host:`](/documentation/Foundation/NSConnection/connectionWithRegisteredName:host:) and [`rootProxyForConnectionWithRegisteredName:host:`](/documentation/Foundation/NSConnection/rootProxyForConnectionWithRegisteredName:host:) class methods.

If the receiver was already registered under a name and this method returns <doc://com.apple.documentation/documentation/Swift/false>, the old name remains in effect. If this method is successful, it also unregisters the old name.

To unregister an `NSConnection` object, simply invoke [`registerName:`](/documentation/Foundation/NSConnection/registerName:) and supply `nil` as the connection name. Unregistering is currently only supported for [`SocketPort`](/documentation/Foundation/SocketPort)-based connections.

## See Also

[`+ (NSPortNameServer *) systemDefaultPortNameServer;`](/documentation/Foundation/NSPortNameServer/systemDefaultPortNameServer)

Returns the single instance of `NSPortNameServer` for the application.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)