Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Data Model Version Compile".. error after upgrading to Lion (Xcode4.1)

Since upgrading to Lion yesterday (10.6->10.7), I've been unable to compile a project that had no problems compiling prior to the upgrade.

It's not even a recent change to the project that's causing this error: If I checkout from SVN a version of the project from a few days or a week ago, I get the same error whilst building:

"Command /Developer/usr/bin/momc failed with exit code 6", which expands to the following:

Build Error:

DataModelVersionCompile /Users/ian/Library/Developer/Xcode/DerivedData/inventory-gtvznzuhomhlakbdpocaqwnrihhx/Build/Products/Debug-iphonesimulator/inventory.app/inventory.momd inventory/inventory.xcdatamodeld
cd /Users/ian/AppsDev/uk.co.isurvey-inventory/ios/inventory/trunk/inventory
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/usr/bin/momc -XD_MOMC_SDKROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -XD_MOMC_IOS_TARGET_VERSION=4.3 -MOMC_PLATFORMS iphonesimulator -MOMC_PLATFORMS iphoneos -XD_MOMC_TARGET_VERSION=10.6 /Users/ian/AppsDev/uk.co.isurvey-inventory/ios/inventory/trunk/inventory/inventory/inventory.xcdatamodeld /Users/ian/Library/Developer/Xcode/DerivedData/inventory-gtvznzuhomhlakbdpocaqwnrihhx/Build/Products/Debug-iphonesimulator/inventory.app/inventory.momd

2011-07-21 19:24:44.954 momc[4436:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSXMLDocument initWithData:options:error:]: nil argument'
*** First throw call stack:
(
0   CoreFoundation                      0x00007fff8e411986 __exceptionPreprocess + 198
1   libobjc.A.dylib                     0x00007fff8d0d5d5e objc_exception_throw + 43
2   CoreFoundation                      0x00007fff8e4117ba +[NSException raise:format:arguments:] + 106
3   CoreFoundation                      0x00007fff8e411744 +[NSException raise:format:] + 116
4   Foundation                          0x00007fff8c761310 -[NSXMLDocument initWithData:options:error:] + 89
5   momc                                0x0000000102f04a2c momc + 10796
6   momc                                0x0000000102f04fe8 momc + 12264
7   momc                                0x0000000102f058f0 momc + 14576
8   momc                                0x0000000102f03d20 momc + 7456
9   ???                                 0x000000000000000a 0x0 + 10
)
terminate called throwing an exception
Command /Developer/usr/bin/momc failed with exit code 6

Further explanation:

AFAIK, the only difference is that I'm using Lion now, and the Lion version of Xcode 4.1 (where I was using Xcode 4.1 for Snow Leopard prior to this).

I've deleted /Developer/ , I've reinstalled several times, and re-downloaded the App Store Xcode installer too, in case it was corrupt.

If I create a new project using Xcode (and use Core Data, I think that's related to whatever problem there is building my project), it builds and runs fine: maybe there's something I need to do to fix my real project?

Any suggestions would be brilliant! Cheers, Ian

like image 658
Ian Dundas Avatar asked Jul 22 '11 09:07

Ian Dundas


2 Answers

I've had the same issue, OS X Lion 10.7.1, Xcode 4.1.

The problem is solved by removing all *.xcdatamodel directories that are not displayed in Xcode from your *.xcdatamodelid directory. These directories appear after *.xcdatamodel renaming in Xcode.

Removing may be done in Terminal, by “Show package contents” menu in Finder or by right-clicking on xcdatamodel in Xcode and selecting "Show in Finder".

like image 89
Misha Karpenko Avatar answered Nov 15 '22 21:11

Misha Karpenko


Restart XCode and delete all the data from the Derive Data Folder.

like image 34
Developer Avatar answered Nov 15 '22 20:11

Developer