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

overriding UIManagedDocument -savingFileType

I'm trying to override UIManagedDocument's -savingFileType so that my app's files can be of a type other than a folder. -(NSString*)savingFileType{ return @"com.myCo.myApp"; } - (NSString *)fileNameExtensionForType:(NSString *)typeName…
olynoise
  • 2,016
  • 2
  • 19
  • 32
3
votes
3 answers

UIDocument not saving?

No matter what I try, this isn't working... I am trying to use UIDocument to save my (text) files locally. When I create a file (i.e. it isn't loaded), it saves fine. However, if I load my file by opening it and then save it, it simply won't…
Macro206
  • 2,143
  • 3
  • 19
  • 25
3
votes
1 answer

How to do incremental writing for UIDocument in iCloud?

I have UIDocument in iCloud ubiquitous container and I need to append data to file while saving document. I override readFromURL:: and writeContents::::: method according UIDocument documentation: -(BOOL) writeContents:(id)contents…
Vitaly Kudrin
  • 231
  • 1
  • 2
  • 9
3
votes
1 answer

iCloud files keep reappearing after deleting

I have the following setup: My app writes UIDocument instances to iCloud. The files get synced and everything works fine. But when I try to delete them they keep reappearing. Before I delete the files I close them. Here is the code that deletes the…
ralphbert
  • 123
  • 2
  • 8
3
votes
0 answers

How to open a UIDocument after UIDocumentStateSavingError exists?

In my iCloud-based app, I noticed that if a crash were to occur while a UIDocument is open (and has not yet been closed), the status of the document sometimes becomes UIDocumentStateSavingError and it never opens successfully again. When I run…
Anton
  • 3,998
  • 25
  • 40
3
votes
2 answers

UIDocument loadFromContents fails with EXC_BAD_ACCESS

I have a pretty simple IOS app using iCloud document storage. Everything was working and then at some point I began encountering a EXC_BAD_ACCESS error in my document load method for at least one iCloud document, although most files load just…
Scott Boring
  • 2,601
  • 1
  • 25
  • 31
3
votes
1 answer

Can We Determine What's Changed in an iCloud file package?

I am attempting to use a iCloud-enabled UIDocument with a directory-based NSFileWrapper (aka File package) to maintain a complex application state. In my app, the user can have many distinct configurations (kind of like cars that have seat…
Mike M
  • 4,358
  • 1
  • 28
  • 48
3
votes
2 answers

UIDocument openWithCompletionHandler: crash

I'm using Core Data in my project and get a rare crash in the following code section -(void) useDocument{ AFFormsCoreDataEngine* engine = [AFFormsCoreDataEngine sharedInstance]; if (![[NSFileManager defaultManager] fileExistsAtPath:…
NikGreen
  • 700
  • 9
  • 28
3
votes
1 answer

iCloud Save data With UIDocument crash

I am trying to use iCloud to store my app's userSetting, here is my Save & Load Code: , it usually doing fine but sometimes crash with message like: attempt to open or a revert document that already has an open or revert operation in flight or send…
Jeff Wang
  • 183
  • 2
  • 11
3
votes
1 answer

UIDocument related EXC_BAD_ACCESS

At the very beginning of my app, I try to load every UIDocument to get a little preview of their contents. This works very well most of the time, but sometimes I get a crash right after loading a UIDocument. My problem is that I have no idea how to…
n.evermind
  • 11,944
  • 19
  • 78
  • 122
3
votes
1 answer

UIDocument never calling dealloc

I have an issue where I can't seem to dealloc UIDocument (used in iCloud) After running an NSMetaDataQuery to look for the document as follows.. NSMetadataQuery *query = [[NSMetadataQuery alloc] init]; _query = query; [query setSearchScopes:[NSArray…
Bongeh
  • 2,300
  • 2
  • 18
  • 30
3
votes
1 answer

Common iCloud container between Mac and iOS app?

I want to build an iCloud based app that runs on both the Apple platforms, iOS and Mac. The app will use UIDocument on iOS and NSDocument on Mac to have a document based synchronization model - documents created on iOS will be available on Mac and…
Dhiraj Gupta
  • 9,704
  • 8
  • 49
  • 54
3
votes
1 answer

What does it mean when a URL reports true for NSURLUbiquitousItemHasUnresolvedConflictsKey but there are no other versions of the URL?

In order to test conflicts, I've been saving two different versions of the same document on two devices. On both devices I would then be able to look at the currentVersionOfItemAtURL to see the 'winning' version - which was the same on both devices…
Simon
  • 25,468
  • 44
  • 152
  • 266
3
votes
0 answers

openWithCompletionHandler is not returning on my devices

I am struggling with odd behavior I encounter when I'm trying to open a UIDocument from iCloud that has been created using another device. When I call openWithCompletionHandler it never completes. Here's how I reproduce the behavior: I created a…
Michael Kalika
  • 251
  • 2
  • 10
3
votes
1 answer

UIDocument openWithCompletionHandler return NO for success

I have this code: [metaDoc openWithCompletionHandler:^(BOOL success) { if (!success) { NSLog(@"UH OH"); } }]; Why would this ever return NO? For me it's returning NO even though in my - (BOOL)loadFromContents:(id)contents …
0xSina
  • 20,973
  • 34
  • 136
  • 253