Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse engineer Core Data 'mom' file

Is there any way to reverse engineer a Core Data 'mom' file (compiled core data model)?

like image 959
user204884 Avatar asked Jan 10 '11 10:01

user204884


2 Answers

Yes it can be done with momdec.

Here is a link to my fork that adds support for to-many relations:

Build the project and then copy the command line app from Products to your bin folder.

Here is an example of how to reverse engeinner the Notes app model which is a very interesting one, in particular its use of entity inheritance:

cd "/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot"

momdec System/Library/PrivateFrameworks/NotesShared.framework/NoteData.mom ~/Desktop/   

enter image description here

like image 144
malhal Avatar answered Oct 31 '22 11:10

malhal


There is a way to do this easily.

You can import a compiled datamodel file (.mom) into a model design document (.xcdatamodel) using Xcode > Design > Data Model > Import. This will effectively allow you to 'reverse engineer', if you wish, the compiled mom file and inspect it's model.

Edit:

In the Xcode 5 and later, the menu is under Editor->Import. But this menu will only appear when you click the .xcdatamodel

like image 20
strange Avatar answered Oct 31 '22 11:10

strange