CoreData Guardar cambios en el objeto al salir

This question takes reference to this one (code can be seen there): TO THE QUESTION

If I create a few new Objects, I can work with them, change between them etc. Everything works. But if a close the app completely (in the iOS5 Multitasking Bar) and open it up again, I got the number of objects I created, but all of the attributes are set to the standard values. That is the case with all objects except of one: The one which stands on top of the list. Did I forget a save command anywhere? Thanks!

preguntado el 08 de noviembre de 11 a las 11:11

Just a wild guess: have you checked the error result of the save call to the managed object context? If there is any problem with the objects being saved (e.g. constraints not fulfilled) the save could fail. Although the objects shouldn't turn up at all then this would be the first thing to check. -

Hi Phoenix, thanks to you for your contribution but the problem was that there fue no save by application quit at all. :) -

1 Respuestas

Intenta llamar saveContext in applicationWillResignActive.

respondido 08 nov., 11:16

NSError *error; [__managedObjectContext save:&error]; ... did it. Thanks! - DAS

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.