Is there any way to reverse engineer a Core Data 'mom' file (compiled core data model)?
Asked
Active
Viewed 3,564 times
12
-
What's your motivation behind it? You can get a list of entities, relationships and attributes without reverse engineering it. – Eimantas Jan 10 '11 at 10:31
-
1I was given an app without its sources which I am trying to understand. How do I get the information you mentioned? – user204884 Jan 10 '11 at 10:38
2 Answers
20
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
1
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/

malhal
- 26,330
- 7
- 115
- 133