---
title: "unregister(completionHandler:)"
framework: servicemanagement
role: symbol
role_heading: Instance Method
path: "servicemanagement/smappservice/unregister(completionhandler:)"
---

# unregister(completionHandler:)

Unregisters the service so the system no longer launches it and calls a completion handler you provide with the resulting error value.

## Declaration

```swift
func unregister(completionHandler handler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func unregister() async throws
```

## Parameters

- `handler`: A completion handler to call with the result of the unregistration operation. Upon an unsuccessful return, the handler contains a new doc://com.apple.documentation/documentation/Foundation/NSError object describing the error. Upon successful return, this argument is NULL.

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func unregister() async throws For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.

## See Also

### Registering services

- [register()](servicemanagement/smappservice/register().md)
- [unregister()](servicemanagement/smappservice/unregister().md)
