I’ve been reading this book since the early beta stages. I have to say that it’s come a long way. The final product is a fantastic reference, full of great insight and time-saving tips.
I’ve been looking through the book and sample code on Apple and the net in general. I haven’t been able to find a consensus approach to drag-and-drop with Core Data. The section in Chapter 9 in the book on the recursive save seems closest to what I want, but I don’t think drag-and-drop needs to be quite as involved as the importing and exporting code provided there.
Would someone please point me towards the latest and greatest understanding of drag-and-drop of NSManagedObjects in 10.6?
In my app, I have two windows, one showing a device and another listing elements that could be added to the device. Each element contains a few strings and three sets that all need to be copied to the device. The copied elements’ parents will be set to the device. Dragging from the elements list to the device should create a copy of the dragged element and set the device as the parent of that element. Both the device and the elements that can be added to it exist in the same MOC.
I’ve seen sample code using URIs, sample code (from Apple) using - dictionaryWIthValuesForKeys and Marcus’ much more involved recursive copy method for importing and exporting. I suspect the solution I need is somewhere in the middle. But, I do need to copy the element and all of its relationships.