Compile Error


#1

For some reason when I compile your code (downloaded from this site yesterday) or the code I typed in, I get this error:

2010-08-01 13:52:54.713 Inventory[1210:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't merge models with two different entities named 'Inventory'' *** Call stack at first throw: ( 0 CoreFoundation 0x022ec919 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x0243a5de objc_exception_throw + 47 2 CoreData 0x000c7e19 +[NSManagedObjectModel modelByMergingModels:] + 3865 3 CoreData 0x000c642b +[NSManagedObjectModel mergedModelFromBundles:] + 507 4 Inventory 0x00002e23 -[AppController managedObjectModel] + 115 5 Inventory 0x00002f47 -[AppController persistentStoreCoordinator] + 237 6 Inventory 0x00002d11 -[AppController managedObjectContext] + 85 7 Inventory 0x0000285b -[AppController allInstancesOf:orderedBy:] + 67 8 Inventory 0x00003226 -[LocationListViewController init] + 138 9 Inventory 0x00002adc -[AppController applicationDidFinishLaunching:] + 66

I’m running Xcode 3.2.3, Base SDK iPhone Device 4.0.

Any ideas?
-Matt


#2

Hi,

Core Data isn’t my strong point so I’ll only be able to take this so far.

What appears to be happening is that there are now two models in your application bundle - possibly created from the process of downloading one and the one you typed in. Core Data is trying to merge them into one model and fails as there will obviously be duplicate entities.

Try doing a Build / Clean All Targets to zap the application bundle and then try again.

Gareth