yepher / CoreDataUtility

An OSX application that simplifies development and debugging of CoreData enabled applications.
519 stars 49 forks source link

Empty Managed Object Model #41

Closed gantaa closed 9 years ago

gantaa commented 9 years ago

Thanks for the work on this. the tool looks very useful. Can you provide a little more info on the modelURL in the workaround for XCode 6 and the generation of the .cdp file?

I can launch the generated file and see my schema, however there is 0 data. I have tried the full path of the mom file (without filename), full path of mom file (with correct file name - fitboardData.mom), and also tried omitting file:// at the start of the path. All 3 scenarios yield an empty model, yet my app has core data objects, and the core data mom file DOES exist in the location specified by the cdp file.

I am using CoreDataPro 1.4 (7) and here is an attempt at my generated cdp file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>modelFilePath</key>
    <string>file:///Users/matt/Library/Developer/CoreSimulator/Devices/013354DF-0911-4BB9-A6FD-4EFB9127F338/data/Containers/Bundle/Application/0BCB8189-F58D-4142-B121-737FE5178E95/GroupNerds.app/fitboardData.momd/fitboardData.mom</string>
    <key>storeFilePath</key>
    <string>file:///Users/matt/Library/Developer/CoreSimulator/Devices/013354DF-0911-4BB9-A6FD-4EFB9127F338/data/Containers/Data/Application/515FD720-73E7-443B-B199-CCA18F343C3E/Documents/test.sqlite</string>
    <key>storeFormat</key>
    <integer>1</integer>
    <key>v</key>
    <integer>1</integer>
</dict>
</plist>
yepher commented 9 years ago

@gantaa

I believe XCode 6 to be working fine now for iOS Simulators. Based on what it appears you want to do I think it maybe easier for you to do this:

  1. File->New Project
  2. Select iOS Simulator Tab
  3. Expand the device you are using for the simulator
  4. Select the "App" you are wanting to view "GroupNerds.app"
  5. Select "2. Select Model File" button
  6. Select your .momd file "fitboardData.momd"
  7. Select "3. Persistence File" button
  8. Select "test.sqlite"
  9. Make sure "SQL" is selected in the persistence store format list
  10. Select "open"

Assuming all that worked you can save the project file anywhere you want and you can view the format from there.

If you are actually in need of dynamically generating the project files the above should give you what you need for project file format. I would also suggest having a look at the command line option or this script: https://github.com/yepher/CoreDataUtility/blob/master/tools/bin/createCoreDataProject.sh

I hope that helps. If you still have problems let me know.

If this is what you need please close the issue.

gantaa commented 9 years ago

I was previously using an old version of CoreDataPro that didn't have that device list. It was just a dropdown that showed ios version folders older than 8, which was why I attempted generating the cdp file from my project. With the latest version, I am able to complete all of the steps you have listed above and open the correct project. However, the project still has empty data. Do you have any tips on debugging and finding out why none of my existing CoreData objects are being shown?

yepher commented 9 years ago

I am not aware of any problem with opening mom or sqllite files. So since this is working for me I am going to make the assumption that the problem is on your side.

Here is where I would start:

  1. Open Terminal
  2. Change to the directory where your sqllite file is stored
  3. Type "sqlite3 test.sqlite"
  4. Type ".dump" and make sure there is data in the file

I believe that file is probably empty.

If the file is not empty than it would be great if you could download the project and run it in the debugger and send me the log output (or send me the mom and sqllite file).

I expect this will give us a good start towards getting the problem you are seeing sorted out.

gantaa commented 9 years ago

Does it have anything to do with Write Ahead logging being enabled? There are 3 sqlite files in that directory: test.sqlite, test.sqlite-shm, and test.sqlite-wal.

I have seen some sqlite browsers that do not support this. Is there a way to turn off this feature in IOS?

yepher commented 9 years ago

I've not had any problem with the shadow files while using the tool. There maybe problems that I am not aware of but it's not been an issue for me so far or anyone I know so far.

gantaa commented 9 years ago

The sqlite dump only includes the schema creation. The records are either getting stored somewhere else, or not at all. I am able to fetch core data objects in the debugger of my app. I'll keep researching. Let me know if you think of anything else that might help.

gantaa commented 9 years ago

screen shot 2015-03-06 at 9 48 26 am

What is the (null) here? Is that ok?

yepher commented 9 years ago

If you have Chrome or Firefox you can go here and I can maybe help you out a little.

https://opentokrtc.com/CoreDataUtil

I will stay in the room for the next 30 minutes.

gantaa commented 9 years ago

Boom. There are errors in my save context that I wasn't logging. So every save to the context would fail, thus no CoreData in my store. Thank you for the help. Sorry I'm a fool.

yepher commented 9 years ago

Glad you figured it out. Good luck.