---
title: activate()
framework: xpc
role: symbol
role_heading: Instance Method
path: xpc/xpclistener/activate()
---

# activate()

Activates an inactive listener.

## Declaration

```swift
func activate() throws
```

## Discussion

Discussion If you create an inactive listener using the inactive flag, be sure to activate it before releasing the last reference to the listener. Releasing the last reference to an inactive listener crashes. If activation fails, the system automatically cancels the listener.

## See Also

### Managing the life cycle

- [cancel()](xpc/xpclistener/cancel().md)
