File Provider
Overview
If your app focuses on providing and syncing user documents from remote storage, you can implement a File Provider extension to give users access to those documents when they’re using other apps. If you just need to share local documents, see Share files locally below.
The framework has two different starting points for building your File Provider extension.
NSFile
Provider Replicated Extension The system manages the content accessed through the File Provider extension. Available in macOS 11+ and iOS 16+.
NSFile
Provider Extension The extension hosts and manages the files accessed through the File Provider extension. Available in iOS 11+.
The replicated extension takes responsibility for monitoring and managing the local copies of your documents. The file provider focuses on syncing data between the local copy and the remote storage—uploading any local changes and downloading any remote changes. For more information, see Replicated File Provider extension.
The nonreplicated extension manages a local copy of the extension’s content, including creating and managing placeholders for remote files. It also syncs the content with your remote storage. For more information, see Nonreplicated File Provider extension.
Share files locally
You don’t need a File Provider extension to allow access to documents that your app stores locally.
In iOS, to give other apps access to the files in your Documents
directory, set the following keys in your app’s Info tab or its Info
file. For document browser-based apps, set the UISupportsDocumentBrowser key. For all other apps, set both the UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys.
After you set these keys, other apps can open and edit the contents of your Documents
directory in place. Your files also appear in both the Files app and the document browser. For more information, see the UIDocument
class.
Topics
class NSFileProviderManager
typealias NSFileProviderItem
protocol NSFileProviderItemProtocol
struct NSFileProviderItemIdentifier
struct NSFileProviderItemCapabilities
struct NSFileProviderTypeAndCreator
class NSFileProviderDomain
struct NSFileProviderError
enum Code
let NSFileProviderErrorDomain : String
let NSFileProviderErrorItemKey : String
let NSFileProviderErrorNonExistentItemIdentifierKey : String
let NSFileProviderErrorCollidingItemKey : String
struct NSFileProviderVolumeUnsupportedReason