How to open an existing .mom file, or is there any way to see the structure of an existing .mom file

8.6k views Asked by At

I've downloaded a copy of iOS source code and there is a .mom file in the bundle. I just know it is a "product" of NSManagedObjectModel. I wonder is there any way that I can explore the entities in the file, or is there any code snippet to parse its structure. Thank you!

4

There are 4 answers

0
Tom Harrington On

Use the managed object model decompiler [full disclosure: I wrote it] to convert the .mom back into a .xcdatamodel. Then open the result in Xcode.

1
anky_believeMe On

What you can do is add that .mom file which is the core data model to your project and you will be able to explore its entities and attributes.

0
Saeed Mohtasham On

As mentioned by @max in this answer it is a binary plist file. So I tried to convert it to a XML file using this command :

plutil -convert xml1 myfile.mom -o myfile.xml

then you can simply open the file by a text editor.

0
max On

A .mom is often (always?) just a renamed binary property list (.plist) file. Rename it back to .plist and you can easily view its contents with Xcode (or even QuickLook). It may not be the best way to display the data, but you can quickly get an idea of what’s inside.