---
title: "register(_:forItemWithIdentifier:completionHandler:)"
framework: fileprovider
role: symbol
role_heading: Instance Method
path: "fileprovider/nsfileprovidermanager/register(_:foritemwithidentifier:completionhandler:)"
---

# register(_:forItemWithIdentifier:completionHandler:)

Registers the URL session task responsible for the specified item.

## Declaration

```swift
func register(_ task: URLSessionTask, forItemWithIdentifier identifier: NSFileProviderItemIdentifier, completionHandler completion: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func register(_ task: URLSessionTask, forItemWithIdentifier identifier: NSFileProviderItemIdentifier) async throws
```

## 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 register(_ task: URLSessionTask, forItemWithIdentifier identifier: NSFileProviderItemIdentifier) async throws For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.

## See Also

### Performing actions

- [placeholderURL(for:)](fileprovider/nsfileprovidermanager/placeholderurl(for:).md)
- [writePlaceholder(at:withMetadata:)](fileprovider/nsfileprovidermanager/writeplaceholder(at:withmetadata:).md)
- [signalEnumerator(for:completionHandler:)](fileprovider/nsfileprovidermanager/signalenumerator(for:completionhandler:).md)
- [waitForChanges(below:completionHandler:)](fileprovider/nsfileprovidermanager/waitforchanges(below:completionhandler:).md)
- [globalProgress(for:)](fileprovider/nsfileprovidermanager/globalprogress(for:).md)
