EXC_BAD_ACCESS Error in CoreData

Hi team,

We have developed one IoT project in that we have used apple's core database for storing all app-related settings, IoT device settings. In that we are facing some unusual crash (EXC_BAD_ACCESS) whenever we are performing saving, retrieving & updating operations it's causing random issues. So please help me out to fix this issue.

Post not yet marked as solved Up vote post of SuryaRam Down vote post of SuryaRam
1.8k views

Replies

turn on all these flags and see if the debugger points you to an issue in your code.

https://useyourloaf.com/blog/debugging-core-data/

For me it was the name of an CoreData entity attribute. It is not allowed to start an attribute name with "new...". Nothing in Xcode does tell you that and it took me days to find out. I just got the EXC_BAD_ACCESS error.

Just wanted to leave this here for the next poor soul facing my specific problem ;)

The reason for this is explained here: https://developer.apple.com/library/archive/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226-CH1-SW14

I came across this article that lead me to the solution: https://alexj.org/11/core-data-attribute-naming

  • This is crazy I'm crying

  • Thank you! This saved me a lot of time. Yes, the attributes seem to cause random crashes on access when they start with "new", and there isn't any reasonable way of knowing this...

  • Same here! Thanks for posting this