---
title: "prepare(forError:)"
framework: fileproviderui
role: symbol
role_heading: Instance Method
path: "fileproviderui/fpuiactionextensionviewcontroller/prepare(forerror:)"
---

# prepare(forError:)

Performs any necessary setup or configuration when an authentication error occurs.

## Declaration

```swift
func prepare(forError error: any Error)
```

## Parameters

- `error`: An object representing the authentication error. Your File Provider extension can pass additional information in the error’s doc://com.apple.documentation/documentation/Foundation/NSError/userInfo property.

## Discussion

Discussion While your file provider is enumerating its content, the system calls this method whenever your file provider returns an NSFileProviderErrorDomain error with a NSFileProviderError.Code.notAuthenticated code. Use this method to present an interface to authenticate the user.

## See Also

### Working with Actions

- [prepare(forAction:itemIdentifiers:)](fileproviderui/fpuiactionextensionviewcontroller/prepare(foraction:itemidentifiers:).md)
- [extensionContext](fileproviderui/fpuiactionextensionviewcontroller/extensioncontext.md)
- [FPUIActionExtensionContext](fileproviderui/fpuiactionextensioncontext.md)
