iOS 7: What happened to UIDocument / UIManagedDocument and iCloud?
Asked Answered
L

1

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?

Loudspeaker answered 18/9, 2013 at 12:4 Comment(3)
Ask again in 3/4 hours as it's technically still under NDA.Jillian
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.Jacques
Have you found an answer to this doubt? I'm really curious to know if using UIManagedDocument is a good idea or not.Dehydrate
J
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?

Jacques answered 18/9, 2013 at 21:27 Comment(11)
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.Loudspeaker
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.Jacques
P.S. When I say left as an exercise for the developer I mean as UIManagedDocument stands today.Jacques
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...Loudspeaker
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.Jacques
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 APManagedDocumentJacques
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.Jacques
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: https://mcmap.net/q/1918294/-uimanageddocument-icloud-quot-big-picture-quotLoudspeaker
I understand how transaction logs work... I guess I am not understanding your question. :-(Jacques
@Loudspeaker See my updated answer above. I documented my claims a bit more now that iOS 7 is no longer under NDAJacques
"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...?Robin

© 2022 - 2024 — McMap. All rights reserved.