I have a reasonably complex Core Data app for the the iPhone. For the most part, it’s working well, but I’m running into a sporadic problem that manifests itself within Core Data.
I’m fetching data from a remote service, said service returns data. I parse the data and modify various managed objects. Then I save the managed object context and I get an error. In the course of printing the error I get the following message:
*** -[UIImage length]: unrecognized selector sent to instance 0x8cd7aa0
I can isolate the problem down to a single setter in my one of my managed objects. I save the managed object context before using the setting and I save the managed object context right after. Failure happens right after.
This is all being done in the main thread. I have more than one managed object context, but only one persistent store.
Any pointers for debugging this sort of Core Data problem are appreciated.
This particular problem was caused by a method with the word “get” in it that corresponded to a field name in the managed object. It, in turn, masked the real problem which is database related.