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
0 answers

iCloud Document hardly sync after first launch

I'm using UIDocument method to store data in iCloud. So I have 2 devices to test, when I first launch the app on iPhone, then I do some changes then call saveToURL:completionHandler, after that I launch the app on iPad, it's working good, at least…
Cadrick Loh
  • 721
  • 1
  • 7
  • 19
1
vote
1 answer

Correct handling of deletion of a UIDocument in another instance of your app with iCloud

I've found out, that I can detect the deletion of a UIDocument on the iCloud through following method: - (void)accommodatePresentedItemDeletionWithCompletionHandler:(void (^)(NSError *))completionHandler This method gets correctly called, but I…
Linard Arquint
  • 574
  • 3
  • 12
  • 32
1
vote
1 answer

iCloud & UIDocument: Is there a way to clean transaction logs

When using intensively UIDocument with iCloud on multiple devices, lots of transaction logs will be saved to iCloud. This will lead to a reduction of free space on iCloud on a long term use. I wonder if there is a way to clean these logs without…
FrankZp
  • 2,022
  • 3
  • 28
  • 41
1
vote
2 answers

Prevent UIDocument openWithCompletionHandler being called when already opening

I have a singleton class (DTTSingleton) with the following methods: + (UIManagedDocument *)managedDocument { static UIManagedDocument *managedDocument = nil; static dispatch_once_t mngddoc; dispatch_once(&mngddoc, ^ { …
Darthtong
  • 1,017
  • 4
  • 18
  • 30
1
vote
1 answer

iOS: How can I merge conflicted UIDocument's in iCloud?

I'm having trouble understanding what my options are to merge 2 or more conflicted versions of a UIDocument stored in iCloud. After detecting the document conflict, I currently use removeOtherVersionsOfItemAtURL to simply keep the latest version of…
Anton
  • 3,998
  • 25
  • 40
1
vote
2 answers

Using UIDocument saveToUrl throws an NSInvalidArgumentException on NSURL

I'm attempting to make a quick test to synchronize a file to iCloud. This is the simple snippet I have: url = [[ubiquityContainerURL URLByAppendingPathComponent: @"Documents"] URLByAppendingPathComponent:@"test.txt"]; doc =…
CodingBeagle
  • 1,888
  • 2
  • 24
  • 52
1
vote
1 answer

Cannot add UIDocument into an array

If I try to add an opened UIDocument into an array I get nothing out. This might be how it is supposed to work, I'm not sure. - (void)loadDocAtURL:(NSURL *)fileURL withClassName:(NSString *)className { id doc = [[NSClassFromString(className)…
tharris
  • 2,192
  • 2
  • 13
  • 14
1
vote
1 answer

Storing a BOOL in UIDocument using NSFileWrapper

This may be me being incredibly thick, but how do I store a BOOL in a UIDocument? I am currently using NSFileWrappers for storing a string and an image in the "contentsForType:error:" method, but seeing as there's no way to convert a bool into…
Carl Goldsmith
  • 750
  • 1
  • 5
  • 11
1
vote
0 answers

Custom email attachment in iOS

I'm working on developing an ipad app that has the following elements: Albums Images (all images are within albums, there can obviously be many images in one album) Audio (audio is associated to specific images, there can be multiple audio files…
1
vote
1 answer

Slow closing of UIDocument

I have an application with my UIDocument subclass. But the problem is that from time to time method closeWithCompletionHandler works too long. I even can't wait until the end, it takes too much time. The thing is when I put a breakpoint in -…
Riddick
  • 375
  • 4
  • 14
1
vote
1 answer

Pre load core data database coming up black with UIManagedDocument

Hi supportive experts... I'm writing my first iPad app and have a working beta copy that parses an XML file to create a UIManagedDocument Core Data DB on app start up. However this takes a long time and I would like to do it once off line and…
Alison K
  • 145
  • 1
  • 8
1
vote
2 answers

Prevent crash when trying to close UIDocument

I am wondering how I can prevent a crash when trying to close UIDoc twice. I tried to make sure in my code that you (theoretically) can not close a UIDocument twice. However, it still happens sometimes and I don't know why. If it does, the app…
n.evermind
  • 11,944
  • 19
  • 78
  • 122
1
vote
0 answers

How to slow down UIDocument's initial loadFromContents:ofType:error:?

When I drag a file package from Finder into the iTunes.app file sharing pane, my UIDocument class is trying to read in the associated file wrappers, and it appears my code to read it is executing faster than iTunes.app can copy the contents over. …
tobinjim
  • 1,862
  • 2
  • 19
  • 31
1
vote
1 answer

Exception when calling closeWithCompletionHandler: on a UIDocument more than once

Can a single instance of a UIDocument not be opened and closed multiple times? It seems that I can open, close, and re-open a document, but as soon as I try to call closeWithCompletionHandler: on it a second time I get an exception: Terminating app…
Dan Messing
  • 818
  • 7
  • 16
1
vote
1 answer

Upload UIDocument to iCloud on entering background

I have an iCloud enabled application that uses UIDocument to manage its data. When the document is open and the application enters background state the document should be saved and uploaded to iCloud. Saving the document when entering background…
Markus Müller-Simhofer
  • 3,391
  • 1
  • 28
  • 32