UIManagedDocument example / tutorial

adamteale picture adamteale · Jan 2, 2012 · Viewed 9.5k times · Source

I have been trying very unsuccessfully to create a simple UIManagedDocument library style application (separate documents saved to iCloud).

I am confused with the following:

Do I subclass UIManagedDocument and set up the persistentStoreCoordinator, ManagedObjectModel & ManagedObjectContext within this subclass, or are these supposed to be configured within the AppDelegate (and if so, how do I go about refreshing the persistentStoreCoordinator to look at the new file - it seems that once that has read a persistentStore that I can't get it to read a new persistent store)?

Answer

dtrotzjr picture dtrotzjr · Sep 6, 2013

Richard's example is an excellent example. I used it and the PragmaProg book on core data http://pragprog.com/book/mzcd2/core-data as a guide for creating my managed document module on github. See: https://github.com/dtrotzjr/APManagedDocument

My code makes use of iOS 7 iCloud Core Data behavior which I cannot comment on publicly until the NDA is lifted. Feel free to ping me directly if you have any questions.