<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSXPCListener/activate()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSXPCListener(im)activate"
  },
  "title" : "activate()"
}
-->

# activate()

Activates the listener.

```
func activate()
```

## Discussion

Connections start in an inactive state. You must call [`activate()`](/documentation/Foundation/NSXPCListener/activate()) on a connection before it can send or receive any messages.

Calling [`activate()`](/documentation/Foundation/NSXPCListener/activate()) on an active connection has no effect.

For backward compatibility reasons, calling [`resume()`](/documentation/Foundation/NSXPCListener/resume()) on an inactive and otherwise not suspended [`NSXPCListener`](/documentation/Foundation/NSXPCListener) has the same effect as calling [`activate()`](/documentation/Foundation/NSXPCListener/activate()). For new code, prefer [`activate()`](/documentation/Foundation/NSXPCListener/activate()).

---

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)