Questions tagged [uimanageddocument]

UIManagedDocument is a concrete subclass of UIDocument that integrates with Core Data. When you initialize a managed document, you specify the URL for the document location. The document object then creates a Core Data stack to use to access the document’s persistent store using a managed object model from the application’s main bundle.

The persistent store coordinator is set up automatically for you and you can configure it using it's persistentStoreOptions property. -you can use it as a data container, not just for documents. -you can listen to state and store content changes, which makes iCloud syncing easier

Read Apples documentation or an article by Erica Sadun. There is also a great demo video from Stanford Universities Paul Hegarty - check the Core Data demo on iTunes U.

188 questions
3
votes
1 answer

UIManagedDocument: Error/crash on creating new files when network is down (saving)

When I try to save a newly created UIManagedDocument to iCloud and the network is down (e.g. airplane mode) I get the following error(s) with a crash (hexcodes and unreadable stuff removed): -[PFUbiquitySafeSaveFile waitForFileToUpload:](272):…
FrankZp
  • 2,022
  • 3
  • 28
  • 41
3
votes
1 answer

Check if UI(Managed)Document is already in iCloud via URLForUbiquityContainerIdentifier+Path instead of NSMetadataQuery?

I have a quite simple shoebox-style iOS app with 1 single Core Data database (as a UIManagedDocument) and thought about trying to add iCloud support. I of course have to check if there is already an existing database in the cloud *before creating a…
blub
  • 1,014
  • 7
  • 18
3
votes
0 answers

Core Data - UIManagedDocument won't open

I am using Core Data to store a few simple strings related to each user. When the app first starts, everything seems to be fine. The database opens, and I am successfully able to save and retrieve data. However, after some usage, sometimes the…
haplo1384
  • 1,206
  • 1
  • 12
  • 29
3
votes
2 answers

Can create, but not open, a UIManagedDocument with iCloud support

I am creating a new UIManagedDocument with iCloud support as follows: Alloc and init with local sandbox URL Set persistent store options to support iCloud: ubiquitousContentNameKey and ubiquitousContentURL. The name I'm generating uniquely and the…
Jason C. Howlin
  • 3,858
  • 3
  • 21
  • 29
3
votes
2 answers

CoreData Saving Issue

I have a single managed document in my entire application (with two entities) that the user is able to update from two different view controllers. Each view controller has its own NSFetchedResultsController property to relay changes to: a…
3
votes
2 answers

UIManagedDocument OpenWithCompletionHandler never returns

I am running into a weird problem. I am sure that I did something to a file somewhere else in my code and it didn't close properly or something, but now it is in a state where it reports as being closed, but when I call OpenWithCompletionHandler it…
Drew Rosenberg
  • 899
  • 6
  • 7
3
votes
1 answer

Core Data what is created with UIManagedDocument

I am unsure about the structure of coreData and how the objects are saved in a directory. So what I know is that you create an instance of UIManagedDocument and make a URL for it and where it will save files. Then you call "SaveToURL", what exactly…
Terrel Gibson
  • 481
  • 1
  • 6
  • 21
3
votes
1 answer

Core Data Failing on saveToURL on UIManagedDocument

I'm trying to set up core data but when i'm running saveToURL on the UIManagedDocument it's failing to create it. This is my code; @property (nonatomic, strong) UIManagedDocument *currentUserDatabase; @synthesize currentUserDatabase =…
Wasim
  • 4,953
  • 10
  • 52
  • 87
3
votes
1 answer

Is it safe to replace a CoreData persistantStore with NSFileManager?

I have a CoreData database working perfectly with my application. The database stores presets, saved by the user. I want to give the user the ability to backup the database using File Sharing via iTunes. Basically I want to: Backup: Database ->…
3
votes
2 answers

Correct way to remove a UIManagedDocument

I have a feature in my app whereby the User can reset everything on the app by click of a button. At this point, instead of trying to delete all the Core Data relations (Cascade Delete) and other complications, I decided to actually remove the…
Anuj Gakhar
  • 681
  • 2
  • 13
  • 26
3
votes
1 answer

Core Data & UIManagedDocument in Xcode 4.3: Can't merge models

I'd like to thank all the people that contribute to this website. I am one h*ll of a noob at programming and you all help me out so much. With that said, let's get on with my latest problem! I am creating an app that uses a UIManagedDocument to…
Caborca87
  • 187
  • 1
  • 16
3
votes
2 answers

UIManagedDocument nested Contexts

I've been reading apple documents and still there is a question, that a i can't find an answer for. I've got an UIManagedDocument object, which has two nested contexts - the child one on a main thread and a parent one on a private thread. And next,…
2
votes
1 answer

Core Data: UIManagedDocument vs AppDelegate's managedObjectContext @property

There are two ways to get a NSManagedObjectContext that I know of: create a UIManagedDocument and ask for its managed object context access the AppDelegate's managedObjectContext @property. What are the trade-offs here? I've been doing it the…
2
votes
1 answer

UIManagedDocument and NSFetchedResultsController

I'm having issues with saving an entity using a UIManagedDocument. I have a NSFetchedResultsController with its context set as the UIManagedDocuments context. I have the controller set up with sections. The user adds an entry to the…
jonusx
  • 139
  • 3
2
votes
0 answers

What is the easiest way to serialize a UIManagedDocument for cloud backup?

I'm looking to convert the UIManagedDocument to NSData, but its a package directory. The ultimate goal is to upload to Salesforce and recreate from there if the app needs to be reinstalled. The alternative (extracting all the elements from the…