Harvey
Harvey

Reputation: 65

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

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!

Upvotes: 4

Views: 9077

Answers (4)

Saeed Mohtasham
Saeed Mohtasham

Reputation: 1951

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.

Upvotes: 0

max
max

Reputation: 1587

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.

Upvotes: 6

Tom Harrington
Tom Harrington

Reputation: 70956

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.

Upvotes: 5

anky_believeMe
anky_believeMe

Reputation: 484

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.

Upvotes: 0

Related Questions