The error message says that you have a class named TempObject
, that you're trying to call encodeWithCoder:
on it, and that this class does not implement that method. That's a crashing bug, as you're seeing.
It seems that you have a transformable Core Data attribute somewhere, and that you're assigning an instance of TempObject
to this attribute. I don't know where that is. Your code snippet mentions a transformable attribute, but you don't use TempObject
in the code. I can't tell if this code is not actually the cause of the crash or if you changed the name by hand for some reason.
Anyway, when you have a transformable attribute, you must do one of two things:
Make your class conform to
NSCoding
. You said in a comment that you did, but your error message says that you didn't-- or at least, that you didn't finish the job.NSCoding
defines two methods,initWithCoder:
andencodeWithCoder:
, and your class must implement both of them.Create a custom
NSValueTransformer
subclass that can convert your object to/fromNSData
, and configure your Core Data model to use this. Apple provides a couple of really good (but simple) examples of how to do this.
Anything you assign to a transformable attribute must do one of these. Which one is up to you.
It seems that you're trying to do #1 but haven't finished the job. Make sure that your class conforms to NSCoding
.