6

I was taking a look at WWDC 2013 sessions concerning iCloud and Core Data. I was really hoping to see there any new videos for UIManagedDocument or UIDocument. You might remember that those classes theoretically offer a great and simple approach to save data with (UIManagedDocument) or without CoreData (UIDocument) locally and in iCloud. But there have been or still are some really annoying system-based bugs coming along with those concepts, especially when syncing data between devices, see for example here.

However, there was NO video covering the UIManagedDocument/UIDocument and iCloud topic. The video "What's new in Core Data and iCloud?" just covers the classic approach for using Core Data persistent stores which is extended by new API to automatically cover fallback stores and syncing. Has anyone information what happened to UIManagedDocument/UIDocument? Did they give it up and see the classical approach as the better way to have apps with Core Data and iCloud sync?

Community
  • 1
  • 1
FrankZp
  • 2,022
  • 3
  • 28
  • 41
  • Ask again in 3/4 hours as it's technically still under NDA. – CW0007007 Sep 18 '13 at 14:07
  • I do believe that the new fallback stores added to iOS 7's implementation of iCloud addresses your example issue. See the "What’s New in Core Data and iCloud" WWDC 2013 Session 207. – dtrotzjr Sep 18 '13 at 21:40
  • Have you found an answer to this doubt? I'm really curious to know if using `UIManagedDocument` is a good idea or not. – MatterGoal Nov 08 '13 at 16:48

1 Answers1

1

My understanding is that UIManagedDocument is a lightweight wrapper over core-data to abstract away some of the common core data setup and interactions. It is also a way to package other 'document' elements but managing the iCloud syncing of those items is left as an exercise for the developer.

If you are using iCloud, UIManagedDocument does not support “additional content” in the document directory (see additionalContentForURL:error: and related methods)

That's referenced from: UIManagedDocument

See Also: additionalContentForURL:error:

Pretty much anything that applies to core data applies to UIManagedDocument where it uses core data under the hood. For example I make use of the new fallback stores in my APManagedDocument project.

What kinds of things were you hoping to see added in iOS 7?

dtrotzjr
  • 928
  • 5
  • 18
  • I don't share your opinion. `UIManagedDocument` is a subclass of `UIDocument` and integrates in extension to its superclass with Core Data. `UIDocument` itself (and therefore `UIManagedDocument`) is an abstract class for managing document-related actions like coordinated reading & writing, syncing, conflict solving etc. Therefore iCloud syncing is built-in and not an exercise for developers (see the class references for those). I hoped to see further development on those classes AND the needed bug fixing for the syncing processes which are behind the coordinated reads and writes using iCloud. – FrankZp Sep 18 '13 at 21:56
  • It was made clear at WWDC this year that at this time `UIManagedDocument` only sync's the core data portion of a `UIManagedDocument`. I agree with you it would be nice if Apple took these classes further but I think this year they focused on stabilizing core data syncing. I get the sense that `UIManagedDocument` may have been a bit premature seeing that core data syncing is itself just now starting to shape up. Here's hoping next year is better. – dtrotzjr Sep 18 '13 at 22:05
  • P.S. When I say left as an exercise for the developer I mean as `UIManagedDocument` stands today. – dtrotzjr Sep 18 '13 at 22:07
  • Can you please list me the session(s) on which it was made clear that the syncing of `UIManagedDocument's` Core Data was stabilized? Actually this would be good news... – FrankZp Sep 18 '13 at 22:08
  • `UIManagedDocument` was not specifically mentioned it was implied in that `UIManagedDocument` uses core data under the hood and core data syncing was the focus of the core data team this past year. – dtrotzjr Sep 18 '13 at 22:16
  • See: "What’s New in Core Data and iCloud" WWDC 2013 Session 207. For example they mention fallback stores - they did not mention that they work for `UIManagedDocument` but they do and they work amazingly well which is the basis for my [APManagedDocument](https://github.com/dtrotzjr/APManagedDocument) – dtrotzjr Sep 18 '13 at 22:23
  • See also "WWDC 2013 Platforms State of the Union" Session 101 - they mention Core Data sync in iOS 7. Its a brief mention but its encouraging. – dtrotzjr Sep 18 '13 at 22:25
  • Thanks for that. But unfortunately this doesn't convince me that the iCloud syncing of `UIManagedDocuments` Core Data is fixed as this concerns mainly the system-based sync processes of transaction log which are described here: http://stackoverflow.com/a/15174065/1685971 – FrankZp Sep 19 '13 at 06:46
  • I understand how transaction logs work... I guess I am not understanding your question. :-( – dtrotzjr Sep 19 '13 at 15:26
  • @FrankZp See my updated answer above. I documented my claims a bit more now that iOS 7 is no longer under NDA – dtrotzjr Sep 28 '13 at 18:32
  • "What kinds of things were you hoping to see added in iOS 7?" I didn't really expect any additions, but they introduced this class in iOS 5, supposedly makes dealing with Core Data a lot easier, but in every example they give, they're using the traditional stack. What is the "preferred approach"? Use UIManagedDocument only if you're actually dealing with documents and a traditional stack if not? How often does one really deal with a document that has its contents backed by Core Data...? – Scott Berrevoets Sep 28 '13 at 18:49