Questions tagged [uidocument]

UIDocument represents a user-editable document in an iOS application. It is an abstract base class in the UIKit framework. When it is used, its subclass takes the role of the model of a model-view-controller application. Because it implements the NSFilePresenter protocol, it significantly simplifies writing a document-based iOS application. Its Mac OS counterpart is NSDocument.

UIDocument represents a user-editable document in an iOS () application. It is an abstract base class in the UIKit () framework. When it is used, its subclass takes the role of the model of a model-view-controller application. Because it implements the NSFilePresenter protocol, it significantly simplifies writing a document-based iOS application. Its Mac OS () counterpart is NSDocument ().

To learn more, see the Document-Based App Programming Guide for iOS.

268 questions
9
votes
3 answers

UIDocument & NSFileWrapper Architecture and Performance

We've recently converted our code to use UIDocument instead of manipulating files on the file system directly, and we've encountered some performance issues as a result. We are wondering whether we are using this class incorrectly, if anyone else…
Hila
  • 1,080
  • 1
  • 9
  • 22
9
votes
2 answers

UIDocument & NSFileWrapper - NSFastEnumerationMutationHandler while changing file wrapper during a save

I have a UIDocument based app that uses NSFileWrappers to store data. The 'master' file wrapper contains many additional directory file wrappers, each of which represents a different page of the document. Whenever I make a change to the document…
Stuart
  • 36,683
  • 19
  • 101
  • 139
8
votes
3 answers

Document Creation with UIDocumentBrowserViewController

The documentation for documentBrowser(_:didRequestDocumentCreationWithHandler:) says, "Create a new document and save it to a temporary location. If you use a UIDocument subclass to create the document, you must close it before calling the…
user3739999
8
votes
3 answers

ios iphone hooks open instagram directly without showing UIDocumentInteractionController

I'm integrating sharing images through instagram in my app. I've read their documentation. It seems that I need to use the iOS UIDocumentInteractionController to allow this (I understand that it allows access to files in my app's sandbox). Digging…
Avba
  • 14,822
  • 20
  • 92
  • 192
7
votes
2 answers

Sharing a plist file using iCloud

I have a relativley simple app which persists data to a plist file located in the documents folder. The data loads into a UITableView at startup. The user can then edit, delete or add records and any changes get saved back to the plist file. Now I…
smithms
  • 113
  • 2
  • 5
7
votes
3 answers

What is the proper way to move a UIDocument to a new location on the file-system

I have a document-based iOS application with a UIDocument subclass. I need to be able to move the file it represents on the file-system. I have considered moving it with an NSFileManager, but this would mess up the UIDocument's fileURL property. Any…
agentfll
  • 858
  • 2
  • 10
  • 21
7
votes
0 answers

UIDocument crashes at revertToContentsOfURL:completionHandler: with "attempt to revert document that is not yet open"

My iOS app crashes in production at UIDocument.revert(toContentsOf url: URL, completionHandler: ((Bool) -> Void)? = nil). From the error message, it looks as if the document is supposed to be reverted to itself. For example: **** Terminating app…
Mark
  • 6,647
  • 1
  • 45
  • 88
7
votes
2 answers

iOS open app when file is tapped in `Files` app

Some iOS apps with custom file types get launched automatically when a file of that type is tapped (for example, Pages gets launched if a pages file is tapped in the Files app). How can an iOS app which is the owner of a UTI get the same behavior?…
Hristo
  • 6,382
  • 4
  • 24
  • 38
7
votes
1 answer

Rename document without closing UIDocument

How do I rename a document file with an open UIDocument without closing and reopening the document? Closing (saving), moving, and reopening the document takes too long. I have the following code that moves the file: NSFileCoordinator*…
Taylor
  • 5,871
  • 2
  • 30
  • 64
7
votes
3 answers

Returning method object from inside block

I am wondering how to do the following correctly: I have a method that is to return an NSData object. It gets the NSData object from a UIDocument. The NSData object can get large, so I want to make sure it is fully loaded before the response starts.…
Joseph
  • 9,171
  • 8
  • 41
  • 67
7
votes
2 answers

Does NSFileWrapper load everything into memory?

Lets say I have an NSFileWrapper directory. This directory is made up of several levels of directories and files. Some of the files are large. Are all these files loaded into memory, or are they lazily loaded? If they are loaded into memory, are…
Luke
  • 13,678
  • 7
  • 45
  • 79
7
votes
2 answers

How can I sort an icloud NSMetadataQuery result of UIDocument's by modification date?

I have an iOS application that uses a simple UIDocument model with a single content field for iCloud storage. I retrieve the list of documents to populate a UITableView using an NSMetadataQuery. I want to have new documents appear at the top of this…
Jason N
  • 463
  • 3
  • 10
7
votes
1 answer

UIDocument, NSFileWrapper and Images

I have an UIDocument which I'd like to be comprised of (1) a txt file and (2) several jpg images. I put the txt and all the jpgs into a NSFileWrapper. When I load the UIDocument, I need the info in the txt file really quickly, so I load it first and…
n.evermind
  • 11,944
  • 19
  • 78
  • 122
6
votes
2 answers

iOS Swift 3 Copy File to iCloud Drive Programatically

In my I'm having documents download option. When users downloading documents from my app I need to store it to users iCloud Drive which was install in users mobile already. I have configured iCloud in both web and in Xcode, but problem is I'm not…
Kavin Kumar Arumugam
  • 1,792
  • 3
  • 28
  • 47
6
votes
1 answer

iOS 7: What happened to UIDocument / UIManagedDocument and iCloud?

I was taking a look at WWDC 2013 sessions concerning iCloud and Core Data. I was really hoping to see there any new videos for UIManagedDocument or UIDocument. You might remember that those classes theoretically offer a great and simple approach to…
FrankZp
  • 2,022
  • 3
  • 28
  • 41
1
2
3
17 18