Platforms to show: All Mac Windows Linux Cross-Platform

UIDocumentPickerMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Navigation MBS MacFrameworks Plugin 22.3 ❌ No ❌ No ❌ No ✅ Yes iOS only
Function: A view controller that provides access to documents or destinations outside your app’s sandbox.
Notes:
Use a document picker view controller to select a document to open or export, and optionally copy. Don’t copy the document if you can avoid it. The document picker operates in two modes:

Open a document. The user selects a document. The document picker provides access to the document, and the user can edit the document in place. Optionally, you can specify that the document picker makes a copy of the document, leaving the original unchanged.

Export a local document. The user selects a destination. The document picker moves the document, and the user can access it and edit it in place. Optionally, you can specify that the document picker makes a copy of the document, leaving the original unchanged.

Working with External Documents
Both the open and export operations grant access to documents outside your app’s sandbox. This access gives users an unprecedented amount of flexibility when working with their documents. However, it also adds a layer of complexity to your file handling. External documents have the following additional requirements:
The open and move operations provide security-scoped URLs for all external documents. Call the startAccessingSecurityScopedResource method to access or bookmark these documents, and the stopAccessingSecurityScopedResource method to release them (see NSURLMBS class). If you’re using a UIDocument subclass to manage your document, it automatically manages the security-scoped URL for you.

Always use file coordinators (see NSFileCoordinatorMBS) to read and write to external documents.
Always use a file presenter (see NSFilePresenterMBS) when displaying the contents of an external document.

Don’t save URLs that the open and move operations provide. You can, however, save a bookmark to these URLs after calling startAccessingSecurityScopedResource to ensure you have access. Call the bookmarkDataWithOptions method and pass in the NSURLBookmarkCreationWithSecurityScope option, creating a bookmark that contains a security-scoped URL.

For more information about working with external documents, see Providing Access to Directories and Adding a Document Browser to Your App.

Modes

Constant Value Description
ModeExportToService 2 The document picker exports a local file to a destination outside the app’s sandbox.
ModeImport 0 The document picker imports a file from outside the app’s sandbox.
ModeMoveToService 3 The document picker moves a local file outside the app’s sandbox and provides access to it as an external file.
ModeOpen 1 The document picker opens an external file outside the app’s sandbox.

This class has no sub classes.

Some examples using this class:

Blog Entries


The items on this page are in the following plugins: MBS MacFrameworks Plugin.


UDPSocketMBS   -   UNCalendarNotificationTriggerMBS

Feedback: Report problem or ask question.

The biggest plugin in space...


Start Chat