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
1
vote
1 answer

How to wait for UIDocument openWithCompletionHandler to execute?

I want to ensure at app start that nothing goes on until UIDocument openWithCompletionHandler: is finished. The thing is openWithCompletionHandler runs on the main thread and I believe it has to (?) I am currently using the asynchronous approach but…
Pedro Borges
  • 1,568
  • 1
  • 14
  • 25
1
vote
2 answers

UIDocument autosave not working when calling updateChangeCount

I have a custom subclass of UIDocument that I use to store the user's content for my app. I call -[UIDocument updateChangeCount:UIDocumentChangeDone] directly to track changes to the document. Saving and loading work fine, but the document never…
Jayson
  • 1,689
  • 14
  • 26
1
vote
1 answer

How to know if a file is encoded?

I have two types of files in iCloud's Docs folder: Text files Encoded files with NSCoding protocol Both types uses .txt extension. How can I know whether a file was encoded? Since I don't know whether a file is a text file or an encoded file,…
Aнгел
  • 1,361
  • 3
  • 17
  • 32
1
vote
1 answer

iCloud: Is it possible to use KVS for custom objects?

I am trying to wrap my head around iCloud storage. I have read through the iCloud Design Guide and some questions here on SO. Here is my scenario: I have a class that only has an NSMutableArray...that collection holds my custom objects which all…
Jason Renaldo
  • 2,802
  • 3
  • 37
  • 48
1
vote
1 answer

How to Sync an NSDocument from iPad/iPhone to Mac osx with iCloud

How to Sync an nsdocument from ipad/iphone to Mac osx with icloud I managed to get it working! from Mac osx to iPhone/iPad but not from iPad/iPhone to Mac osx Here's my code from the subclassed nsdocument file on osx: Header file: #import…
Refael.S
  • 1,634
  • 1
  • 12
  • 22
1
vote
1 answer

How to read conflicted UIDocument from unresolvedConflictVersionsOfItemAtURL:

When Conflict occur in UIDocument I can get all conflicted version by calling unresolvedConflictVersionsOfItemAtURL: on NSFileVersion but how can I get UIDocument (snapshot) of that versions ? I want to loop all versions and merge it…
sarunw
  • 8,036
  • 11
  • 48
  • 84
1
vote
1 answer

Moving a package file of UIDocument class to iCloud

I'm writing an app which saves and loads documents both locally and on iCloud. Locally is working fine, but I'm having a problem with iCloud. The documents are saved as a package - the UIDocument reads and writes an NSFileWrapper which contains an…
Nabeel Thobani
  • 939
  • 10
  • 23
1
vote
2 answers

Opening Several UIDocuments in Succession and Waiting for Them to Finish

I'm having trouble getting my head around the way UIDocuments open asynchronously. I have a series of UIDocuments that the user has created. When the user presses a button I need to open some of the documents, pull some strings from them, and…
davextreme
  • 995
  • 9
  • 23
1
vote
1 answer

autosaveWithCompletionHandler: (UIDocument) overriding issue

Not overriding autosaveWithCompletionHandler:, whenever the document is changed( [doc updateChangeCount: UIDocumentChangeDone]) autosaveWithCompletionHandler: is periodically called. But if I override this method, it is called only once. Document…
Seong
  • 33
  • 1
  • 4
1
vote
1 answer

Differences of NSDocument and UIDocument in iCloud development for ios

Can some one explain me what are differences of UIDocument class and NSDocument class when it comes to developing iCloud for an ios app? which one is better for file-based application?
1
vote
1 answer

UIDocument closeWithCompletionHandler: completes immediately

Documentation of closeWithCompletionHandler" says: "After the save operation concludes, the code in completionHandler is executed." However, in my app this code: NSLog(@"closeWithCompletionHandler"); [self.document closeWithCompletionHandler:^(BOOL…
proxi
  • 1,243
  • 10
  • 18
1
vote
1 answer

How to manage state preservation and restoration in iOS 5

I've been having a look at the "State Preservation and Restoration" section in iOS App Programming Guide, and the process described there seems to be available only from iOS 6. Since I need to make my app compatible from iOS 5, I don´t find a, let's…
AppsDev
  • 12,319
  • 23
  • 93
  • 186
1
vote
1 answer

UIDocument loadFromContents should return a NSFileWrapper; returns NSConcreteData instead

I am making a text editor app that stores each of its document as a NSFileWrapper directory, with document text and document title as separate files in the directory. I expect the contents part of loadFromContents: (id) contents to be a…
merah
  • 61
  • 2
  • 10
1
vote
2 answers

Can I send UIDocuments by email, as an attachment?

I'm working with Xcode. In my app I save some UIdocuments at that location [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]; I'm searching for a way to share documents, my first option is by…
KGS-12
  • 537
  • 4
  • 7
1
vote
1 answer

iOS application with local and iCloud support

If the ubiquity container (iCloud folder) is not available for whatever reason, I add any new documents to the users 'Documents' directory, however, should it become available again I add the documents to the ubiquity container. My question is, what…
Adam Carter
  • 4,741
  • 5
  • 42
  • 103