0

So I am going back to update a Mac app that uses core data to persist a small amount of user data. I've been using this setup for a while and did not have an issue with this when I compiled under os X snow leopard. Now, when I do a fresh install on my MBP os x Mavericks, the sqlite file has the entity tables set up but no data in any of the fields. This is the code Ive been using:

-(void) saveTheContext {

NSError *error;
if (![[[CoreDataSingleton sharedCoreDataSingleton] managedObjectContext] save:&error]) {
    NSLog(@"error writing to db 2 %@", [error description]);
}
NSLog(@"context saved");

}

I also tried saving to the "parent context" as well and the behavior is slightly different, the initial value i set for a field is loaded in the game even after a relaunch, but still if i look at the sql file there is no data in the fields for the given entity, and even if the value changes in the app on relaunch it goes back to the original value.

I'm thinking it may be a permissions issue with my machine or something, anyone run into this before?

nickthedude
  • 4,925
  • 10
  • 36
  • 51
  • Does the `save:` succeed? If not, what's in the error? How are you inserting objects into your context? You mention a parent context but don't show it or its setup; note that `save:` in a child context only updates the parent, not the persistent store. Note also the change in journal mode to write-ahead logging, which will potentially introduce compatibility problems between Show Leopard and Mavericks versions of your app. – Hal Mueller Aug 09 '14 at 04:05
  • Yes the save is successful according to the control flow. I don't use any parent context, I had just added a call to it after reading a SO post that said it might solve the problem. Everything is boilerplate, well boiler plate from like iOS 4 era days. – nickthedude Aug 10 '14 at 17:37

1 Answers1

0

Well, I restarted my machine and everything now works as it should. Score one for "have you tried turning it on and off again?"

nickthedude
  • 4,925
  • 10
  • 36
  • 51