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
5
votes
1 answer

How do I share one UIManagedDocument between different objects?

I've already taken a look at How do I create a global UIManagedDocument instance per document-on-disk shared by my whole application using blocks? but I don't really get it. What I want to achieve is that there should be only one UIManagedDocument -…
uem
  • 713
  • 1
  • 7
  • 18
5
votes
2 answers

Override managedObjectModel in UIManagedDocument

I'm working with the new UIDocument features in iOS 5.0. I have an existing application that uses multiple different Data Models (momd files). According to the documentation for UIManagedDocument, you can override…
jsapara
  • 201
  • 3
  • 11
5
votes
3 answers

iOS CoreData: How to setup the core data "connection"? Stanford UIDocument vs. Apple template?

I've worked through the Stanford course and setup my first app and core data as in the lecture. Approximately like this (I will shift the code into the app delegate now): - (void)setupFetchedResultsController { NSError *error = nil; …
MichiZH
  • 5,587
  • 12
  • 41
  • 81
5
votes
2 answers

UIManagedDocument Creation in ViewDidLoad

After some research I am still unsure on when / how I should create my UIManagedDocument. @interface ViewController () @property (strong, nonatomic) UIManagedDocument *document; @end @implementation ViewController - (void)…
DogCoffee
  • 19,820
  • 10
  • 87
  • 120
5
votes
1 answer

When do UIManagedDocuments close?

I'm using this blog: http://www.adevelopingstory.com/blog/2012/03/core-data-with-a-single-shared-uimanageddocument.html to create a singleton for a UIManagedDocument singleton. Here is the relevant code in BetterDatabase //In…
Nosrettap
  • 10,940
  • 23
  • 85
  • 140
5
votes
2 answers

UIManagedDocument and Core Data

I have found these Stanford tutorials https://itunes.apple.com/us/course/ipad-iphone-app-development/id495052415, and have been listening a lecture about core data, which is really great. It shows how to access Core Data via UIManagedDocument...…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
5
votes
1 answer

iOS UIManagedDocument : can't open pre loaded persistent store

I'm trying to pre load a persistent store in an app based on UIManagedDocument to deal with core data. Persistent store I try to use in app B, is "generated" and populated thanks to app A. In both app A and B I use the UIManagedDocument handler from…
macbeb
  • 227
  • 2
  • 11
5
votes
2 answers

UIManagedDocument insert objects in background thread

This is my first question on Stack Overflow, so please excuse me if I'm breaking any etiquette. I'm also fairly new to Objective-C/app creation. I have been following the CS193P Stanford course, in particular, the CoreData lectures/demos. In Paul…
Pete C
  • 215
  • 2
  • 11
4
votes
1 answer

use of undeclared identifier 'NSMigratePersistentStoresAutomaticallyOption'

How come I get this error when I'm declaring the code statement below? use of undeclared identifier 'NSMigratePersistentStoresAutomaticallyOption' NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES],…
4
votes
3 answers

Should I use NSFileWrappers in UIManagedDocument?

I am trying to store a plist and several binary files (let's say images) as part of an UIManagedDocument. The name of the binary files are an attribute in Core Data and I don't need to enumerate them, just access the right one when showing the…
Jorge Ortiz
  • 1,556
  • 1
  • 16
  • 19
4
votes
2 answers

UIManagedDocument migrate data model

I am working on an iPhone app that uses a subclass of UIManagedDocument and stores its documents on iCloud. It was all working fine until I changed my core data model / scheme (adding a new model version - like I had several times in the past few…
adamteale
  • 940
  • 2
  • 12
  • 27
4
votes
1 answer

UIManagedDocument and additional content

I have a document based app (multiple documents each one of them with their own core data persistent store). I'm using UIManagedDocument to develop it. Each document is a drawing and I want to be able to save a preview (UIImage) of each drawing. As…
Odrakir
  • 4,254
  • 1
  • 20
  • 52
4
votes
1 answer

Adding to UIManagedDocument from GCD background queue?

I am creating and adding a number of managed objects to Core Data from a background queue. My understanding was that I could not access the context from the background thread so I was using performBlock to schedule adding to Core Data back onto the…
4
votes
1 answer

Using +[NSThread sleep:] to resolve a deadlock issue

I just "solved" what appears to be a deadlock or synchronization issue with: [NSThread sleepForTimeInterval:0.1]; in an app that attaches MPMediaItem (music/images) property references from the IPOD library to object instances, and those…
vmanjz
  • 1,156
  • 1
  • 10
  • 23
4
votes
2 answers

inject managedObjectContext into initial viewController?

I am setting up a Core Data model (UIManagedDocument) in my AppDelegate and was curious about how I might inject a reference to the NSManagedObjectContext into my (storyboards) Initial viewController. I could access it directly in the…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
1
2
3
12 13