Framework

FileProvider

Implement a file provider extension to let other apps access the documents and directories that are stored and managed by your containing app.

Overview

If your app is primarily focused on storing and managing the user's documents, you can implement a file provider extension to give users access to their content while they are using other apps.

Your file provider provides access to files stored on your server.

The file provider extension:

  • Creates placeholders for remote files, letting you download the files only as needed.

  • Intercepts coordinated reads from the host app, so that the file can be downloaded or updated from the remote server before the read occurs.

  • Triggers a notification after coordinated writes from the host app, so that the extension can upload the changes to the remote server, as needed.

  • Enumerates the stored documents and folders.

  • Executes actions on the stored documents and folders, such as importing, moving, renaming, or deleting items.

Other apps access the stored documents using either the UIDocumentBrowserViewController or UIDocumentPickerViewController classes. These classes provide a standard user interface for browsing and interacting with the stored documents and folders; however, you can add custom actions to the browser's context menu using the FileProviderUI framework.

You can also define custom message interfaces for your file provider. Use these interfaces to add features that are not provided by the base API. For more information, see NSFileProviderMessageInterface.

Topics

First Steps

class NSFileProviderExtension

The principal class for the File Provider extension.

class NSFileProviderManager

A manager object that lets you communicate with the File Provider from either your app or your file provider extension.

Provided Items

Items provide information about the documents and folders managed by your file provider.

typealias NSFileProviderItem

An item managed by the File Provider extension.

protocol NSFileProviderItemProtocol

A protocol that defines the properties of an item managed by the File Provider extension.

struct NSFileProviderItemIdentifier

A unique identifier for an item managed by the File Provider extension.

struct NSFileProviderItemCapabilities

An item's capabilities, which define the actions that the user can perform in the document browser.

Content and Change Tracking

Content and Change Tracking

Create enumerators to specify your file provider's content, and track changes to that content.

Compatibility

Creating File Providers for Multiple Versions of iOS

Learn about the differences in file provider behavior introduced in iOS 11.

Errors

enum NSFileProviderErrorCode

The error codes for errors raised by the File Provider extension.

let NSFileProviderErrorDomain: String

The error domain for errors raised by the File Provider extension.

let NSFileProviderErrorCollidingItemKey: String

The key for accessing the existing item from a filename collision error's userInfo property.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software