Skip navigation.
 
mlMerging Core Data models from plugins
FROM : Daniel Price
DATE : Sun Jan 06 21:06:45 2008

I have a Core Data app that I would like to extend via plugin (ie 
bundles). Each plugin would contain it's own xcdatamodel file to be 
merged with the applications Data Model at startup. My app defined an 
entity called 'Shape' which is abstract. The first plugin defines an 
entity called 'Circle' with a duplicate copy of the 'Shape' entity set 
as it's parent. I have second plugin with an entity called 'Square' etc.

Im testing with using the Core Data App template. My understanding is 
that when [mergedModelFromBundles] is called, is ignores entities of 
the same name when they're identical so what I should end up with at 
runtime is a single Data Model with 'Shape' and it's too 'child' 
entities from the plugins; Circle and Square.

For this to be effective, the Circle and Square data models cannot 
include any other entity that 'Shape' (ie. they are independent) and I 
can get this to work with one plugin, but not two.

If I have two plugins loaded, the app freezes at startup. I CAN get it 
work as expected if I include the entire hierarchy in the plugin 
models - that is 'Square' has a copy definition of 'Circle' and vice-
versa, but that breaks the objective.

Any ideas what I'm doing wrong? I don't get any errors in the console 
and I've tried a clean and deleting the .xml store under Application 
Support. I've not been able to find any examples of this. There is no 
other code in my test app other than what is provided by the template 
and each Entity used the NSManagedObject.

Any help appreciated!

Related mailsAuthorDate
No related mails found.