views:

57

answers:

2

My iphone application uses Core Data and a SQLite database; versions are being tracked using SVN. Adding data to the database is not reflected in the application. I make sure I delete the project out of the simulator and that the new database is added as a file to the project. I suspect the data is being cached in another location.

Please note, SVN shows no changes to the database, even when directly edited. Also, if I copy and paste the project to a new folder, delete the hidden svn folders, delete the build folders, edit the DB, delete the project out of the simulator, then compile and run, it works the first time. After that, the data again is cached in some unknown location.

Any ideas where this could be?

UPDATE: The solution to this was to exit my SVN Client (Versions). I am still unsure of how this effected updates to the DB; I wouldnt think it would block or revert any changes. I am now able to edit and save changes.

Thanks everyone for the help.

+1  A: 

Could be more than a couple of things going wrong here. If you have the SQLite DB added to your project by reference, and if you haven't made any code changes, then when you click "Build" you won't see your changed DB resource copied over. Basically, Xcode has long-standing problems sensing when (referenced) resources have changed. Doing a clean build is your nuclear option, as depending on your compilation time, it can take quite a while. A better option is just to delete the .app bundle out of the build directory. This doesn't take as long for Xcode to reconstruct, although if you have a lot of resources, it also can take a while. The best option (the one I use) is to leave a "dummy" file at the root level of the folder included by reference (let's say it's a blank text file), and when I update a resource, I will make a change to the dummy file, undo the change, and hit Save (inside Xcode). This triggers something in Xcode to recursively go through that included directory to see if anything's changed.

All that aside, if you are modifying the DB file, and SVN is telling you that you haven't made changes to it, you have some other problem going on. Simply put, are you certain that the DB file has been added and checked in already to SVN, so SVN knows about it? And are you certain you're editing the same file you're checking in SVN?

Shaggy Frog
Thank you for the reply. I have been cleaning and cleaning all targets. I also tried deleting the .app file and recompiling. I get the same results. SVN only seems to know when the file has been deleted. Editing the DB does not show any changes. I tried your suggestions about the save in xCode, even edited a line of code and did so, results were still the same. Please note, the same behavior occurs in a copy of the project without the SVN folders which makes me suspect that SVN may not be the culprit.
Oh Danny Boy
How are you adding the resource? By reference or not? Is there another resource with the same name? Is there a pre- or post-build process that is doing something with the resource?
Shaggy Frog
I drag the db into the xcode project into a folder. I click "copy if necessary." It shows the DB in project directory along with .xcodeproj
Oh Danny Boy
Instead of using Xcode, just replace the file in the Finder.
Shaggy Frog
A: 

Could it be that the database is elsewhere? Have you tried opening the database manually to see if the right records are there?

MPelletier