Persistance in iPhone Core Data?

NSError *error = nil; if (!context save:&error) { // Handle the error } You can fetch objects you've placed into your context, but unless you save the context to the persistant store, they won't be available next time.

1 This is a good answer but you should NEVER pass nil to the save. Always pass in an error and check your error. Even in examples :) – Marcus S.

Zarra Mar 10 '10 at 16:49 Yes I am saving the context. I am using a helper function for it -(void) writeDB { NSError *error; if (!managedObjectContext save:&error) { // Handle the error. } } – Peyman Mar 10 '10 at 17:27.

Yes I am saving my context through calling a helper function -(void) writeDB { NSError *error; if (!managedObjectContext save:&error) { // Handle the error. } } – Peyman Mar 10 '10 at 17:28.

I found the problem. The context was not saving (and I was not handling the error) because a mandatory property was not being set before saving (error 1520). Thank you all for your help Peyman.

Then kubi was correct. – Marcus S. Zarra Mar 10 '10 at 20:29.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions