Core Data Save Error (NSValidationErrorKey, Cocoa error 1570) saving NSDate

The cocoa error 1570 means that mandatory fields are not filled in. In this case, your have two attribues that are nil : Voedsel and datum.

I see in your code :

newDaglijst.Voedsel = geselecteerdVoedsel;
newDaglijst.datum = selDatum;

Check that geselecteerdVoedsel and selDatum are not nil or that they are overreleased and finish to be nil. If they are optional data (but I don't think so), define them as optional in coredata.

Hope this help,


as Michael A said. Check your attributes value are not nil. There are 2 alternatives to get rid of these error. Case 1:If 2 attributes are Required

If the 2 attributes are required attributes then it is mandatory to check the values you are passing are not nil,It may happens sometimes,If u want to get out of these error u have to give default values for those attributes in attributes inspector of your Entity in data Model

Case 2: Set those attributes to optional in attribute inspector by selecting the check mark of optional.

Me too struggled for days to know these error. Hope it helps someone.