Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core data exception "Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory"

Has anyone seen the source of this Core data exception? What coulds be the cause? Thanks

Core data will throw an exception but continue without any error

Printing the exception breakpoint:

(lldb) po *(id *)($esp + 4)
error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory

Exception is thrown when calling save from a child managed object context

__block NSError *error;
[backgroundContext performBlockAndWait:^{
    [backgroundContext save:&error];
}];
like image 510
amleszk Avatar asked Feb 24 '15 21:02

amleszk


1 Answers

This is due to a constraint violation. If you do a po [$arg1 reason] you should get constraint validation failure meaning that the uniqueness constraint on one of your objects has been violated. How this is then handled will depend on your merge policy.

like image 156
Nick Hingston Avatar answered Nov 17 '22 09:11

Nick Hingston