---
title: "File coordination on iOS | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/ios/features/file-coordination/"
md_url: "https://www.nutrient.io/guides/ios/features/file-coordination.md"
last_updated: "2026-06-05T20:16:40.238Z"
description: "Learn to coordinate file access on iOS using Nutrient iOS SDK. Implement NSFileCoordinator and NSFilePresenter for safe file management across processes and threads."
---

# File coordination on iOS

File coordination encompasses a set of system APIs and callbacks that allow you to coordinate file access safely between different processes or different threads.

It consists of two main system APIs:

- [`NSFileCoordinator`](https://developer.apple.com/reference/foundation/nsfilecoordinator), which coordinates the reading and writing of files and directories among multiple processes and objects in the same process

- [`NSFilePresenter`](https://developer.apple.com/reference/foundation/nsfilepresenter), a protocol that should be implemented by objects that allow the user to view or edit the content of files or directories

[`NSFileCoordinator`](https://developer.apple.com/reference/foundation/nsfilecoordinator) essentially represents a cross-process file-locking mechanism, while [`NSFilePresenter`](https://developer.apple.com/reference/foundation/nsfilepresenter) offers callbacks that can be used to refresh your application state due to external file changes.

## File coordination and Nutrient

Nutrient iOS SDK has supported file coordination out of the box since version 6.7.0. Coordinated file access is handled at the [data provider](https://www.nutrient.io/../../features/data-providers) level using [`CoordinatedFileDataProvider`](https://www.nutrient.io/api/ios/documentation/pspdfkit/coordinatedfiledataprovider). [`CoordinatedFileDataProvider`](https://www.nutrient.io/api/ios/documentation/pspdfkit/coordinatedfiledataprovider) is a subclass of our standard [`FileDataProvider`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filedataprovider), which is designed to read and write data from/to a PDF file on disk. The coordinated subclass adds coordinated file access using [`NSFileCoordinator`](https://developer.apple.com/reference/foundation/nsfilecoordinator) and implements [`NSFilePresenter`](https://developer.apple.com/reference/foundation/nsfilepresenter) callbacks that act on external file modifications.

## Using file coordination in Nutrient

If you are creating a [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) using [`Document(url:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document/init(url:)), then there is nothing you need to do, because you are already using file coordination; [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) will automatically create a [`CoordinatedFileDataProvider`](https://www.nutrient.io/api/ios/documentation/pspdfkit/coordinatedfiledataprovider) behind the scenes when it receives a file URL during initialization.

If you are initializing the document using an explicit [`FileDataProvider`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filedataprovider) (using&nbsp;[`Document(dataProviders:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document/init(dataproviders:))), then we recommend switching to [`CoordinatedFileDataProvider`](https://www.nutrient.io/api/ios/documentation/pspdfkit/coordinatedfiledataprovider) as soon as your application deals with PDF files that could be accessed by other processes or by code in your own application that lies outside of Nutrient.

### Disabling file coordination

In most cases, it is recommended to use the default behavior and keep file coordination turned on for all files. File coordination is important whenever there is a chance that multiple processes (or threads inside your app) could be accessing the same file on disk at the same time. This might happen if you are providing extensions, using iCloud, using our FTS library indexing, or simply executing multithreaded code. However, if you are sure that this is not something that affects you, or if you are experiencing problems related to file coordination, you can opt to not use file coordination inside your app.

You can disable file coordination in two ways:

1. On a case-by-case basis, using [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) via its [`Document(dataProviders:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document/init(dataproviders:)) initializer, by passing a regular [`FileDataProvider`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filedataprovider) instance instead of a [`CoordinatedFileDataProvider`](https://www.nutrient.io/api/ios/documentation/pspdfkit/coordinatedfiledataprovider).

2. By changing the default framework behavior during Nutrient initialization ([`.fileCoordinationEnabled`](https://www.nutrient.io/api/ios/documentation/pspdfkit/sdk/setting/filecoordinationenabled)), as shown below.

### SWIFT

```swift

PSPDFKit.SDK.setLicenseKey(yourLicenseKey, options: [.fileCoordinationEnabled: false])

```

### OBJECTIVE-C

```objc

[PSPDFKitGlobal setLicenseKey:yourLicenseKey options:@{PSPDFSettingKeyFileCoordinationEnabled: false});

```

File coordination takes care of observing changes to the underlying file while it’s open in a [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) or [`PDFViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfviewcontroller). If you disable file coordination, then when you make changes to the underlying file, your app is responsible for telling Nutrient to refresh, like this:

### SWIFT

```swift

pdfViewController.document?.clearCache()
pdfViewController.reloadData()

```

### OBJECTIVE-C

```objc

[pdfViewController.document clearCache];
[pdfViewController reloadData];

```

### PSPDFFileCoordinationDelegate

[`FileCoordinationDelegate`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filecoordinationdelegate) is a replacement for [`NSFilePresenter`](https://developer.apple.com/reference/foundation/nsfilepresenter)-like callbacks on the [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) level. Since a [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) can be composed of several [data providers](https://www.nutrient.io/../../features/data-providers) (and hence several [`CoordinatedFileDataProvider`]s), it doesn’t implement [`NSFilePresenter`](https://developer.apple.com/reference/foundation/nsfilepresenter) directly. Instead, the coordinated providers forward the file presenter calls to the document using [`FileCoordinationDelegate`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filecoordinationdelegate) callbacks. You can override those callbacks in your subclasses if you need to perform custom behaviors in response to document updates. If you do so, be sure to call `super` to ensure appropriate default behaviors are also invoked by [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document). The default implementation of [`FileCoordinationDelegate`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filecoordinationdelegate) in [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) asynchronously dispatches [`PSPDFDocumentUnderlyingFileChanged`](https://www.nutrient.io/api/ios/documentation/pspdfkit/foundation/nsnotification/name/pspdfdocumentunderlyingfilechanged) during both file changes and deletion.

### Registering for file presenter callbacks

File presenters need to be enabled from UI classes when they become active, and they need to be deactivated when UI presentation ends. [`NSFileCoordinator`](https://developer.apple.com/reference/foundation/nsfilecoordinator) defines `addFilePresenter(_:)` and `removeFilePresenter(_:)` for doing this. In addition, Nutrient adds [`FilePresenterCoordinator`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filepresentercoordinator), which defines helpers for registering multiple file presenters at the same time and takes care of automatically temporarily unregistering file presenters while the application is in the background. Failing to do so risks, according to Apple documentation, systemwide deadlocks.

If you are using [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document)s in your custom view controllers, you should use [`FilePresenterCoordinator`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filepresentercoordinator) to initiate file observation when presenting a [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document):

### SWIFT

```swift

FilePresenterCoordinator.shared.observe(document.filePresenters)

```

### OBJECTIVE-C

```objc

[PSPDFFilePresenterCoordinator.sharedCoordinator observeFilePresenters:self.document.filePresenters];

```

You should also do this when ending document presentation:

### SWIFT

```swift

FilePresenterCoordinator.shared.unobserve(document.filePresenters)

```

### OBJECTIVE-C

```objc

[PSPDFFilePresenterCoordinator.sharedCoordinator unobserveFilePresenters:self.document.filePresenters];

```

Be sure to also implement [`PSPDFDocumentUnderlyingFileChanged`](https://www.nutrient.io/api/ios/documentation/pspdfkit/foundation/nsnotification/name/pspdfdocumentunderlyingfilechanged) to receive file coordination changes from the presented document(s).

Built-in Nutrient controllers ([`PDFViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfviewcontroller), [`MultiDocumentViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/multidocumentviewcontroller), and [`PDFTabbedViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdftabbedviewcontroller)) already implement [`FilePresenterCoordinator`](https://www.nutrient.io/api/ios/documentation/pspdfkit/filepresentercoordinator) methods when setting and changing documents, so if you are using or subclassing them, there is nothing you need to do in this regard.

### Responding to file presentation callbacks

Nutrient controllers, including [`PDFViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfviewcontroller), [`MultiDocumentViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/multidocumentviewcontroller), and [`PDFTabbedViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdftabbedviewcontroller), are set up to listen to [`PSPDFDocumentUnderlyingFileChanged`](https://www.nutrient.io/api/ios/documentation/pspdfkit/foundation/nsnotification/name/pspdfdocumentunderlyingfilechanged). Depending on the notification parameters, document state, and system capabilities, the controllers will either trigger appropriate actions to automatically respond to a file change or present a conflict resolution UI. Consult the [conflict resolution](https://www.nutrient.io/../../features/conflict-resolution) guide for more information.
---

## Related pages

- [Open a PDF from a custom data provider on iOS](/guides/ios/features/data-providers.md)
- [Open a PDF from in-memory data on iOS](/guides/ios/open-a-document/from-in-memory-data.md)
- [Open a local file on iOS](/guides/ios/open-a-document/from-local-storage.md)
- [Open a PDF from Document Engine on iOS](/guides/ios/open-a-document/from-document-engine.md)
- [Document Downloads](/guides/ios/miscellaneous/document-downloads.md)
- [Open a PDF on iOS](/guides/ios/open-a-document.md)
- [Open password-protected PDFs on iOS](/guides/ios/open-a-document/password-protected-pdfs.md)
- [Troubleshoot opening a document](/guides/ios/open-a-document/troubleshooting.md)

