Backendless Support
 
Waiting for user's response

Exception "this class is not key value coding-compliant for the key CGImage" when saving object

I have an object BackendlessUser which I'm trying to save. However, I get this exception:

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}

span.s1 {font-variant-ligatures: no-common-ligatures}

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIImage 0x17048a820> valueForUndefinedKey:]: this class is not key value coding-compliant for the key CGImage.'

A bit of background:

BackendlessUser has 1-to-1 relationship with Profile object which has multiple children objects from other tables. I'm getting this error when I add (and configure/create all new children) new Profile object to the BackendlessUser object.

Did anyone have this problem before?

I think I had it previously, but it was connected with naming one of the variables with "image" word. Now, I checked all my object, and I don't think it's still the case.

Leave a Comment

Comments (2)

photo
1

Figured it out.

"Profile" table has column "avatar" which is a foreign key to a record in the different table MaskedImage. Consequently, Profile class in my code (Swift) has attribute "avatar" as well (MaskedImage). The problem was due to the Profile's method called "getAvatar()" which returns UIImage. Apparently, Backendless engine is very sensitive to naming and can't differentiate between attributes/accessors and methods.

Is there a documentation on this topic?

photo
1

Hi Peter,

Our Backendless SDK refers to Java Beans specification in this topic, meaning that all getters are assumed to be properties.