---
title: "getFileProviderConnection(completionHandler:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsfileproviderservice/getfileproviderconnection(completionhandler:)"
---

# getFileProviderConnection(completionHandler:)

Asynchronously returns the service’s connection object.

## Declaration

```swift
func getFileProviderConnection(completionHandler: @escaping @Sendable (NSXPCConnection?, (any Error)?) -> Void)
```

```swift
func fileProviderConnection() async throws -> NSXPCConnection
```

## Parameters

- `completionHandler`: A block that is called on an anonymous background queue. The system passes this block the following parameters:

## See Also

### Accessing the Service

- [name](foundation/nsfileproviderservice/name.md)
