Crash saving an object if a property is called "image"

Hello,

using the iOS SDK
I’m saving an object with several properties (I defined the schema in the backendless dashboard before).

I have a NSString property called image (which is used to store an image url.
When I save the object, there is a crash with the following logs :

*** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<UIImage 0x7fe6ce6552f0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key CGImage.’
*** First throw call stack:
(
0 CoreFoundation 0x000000010d973e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010d3aedeb objc_exception_throw + 48
2 CoreFoundation 0x000000010d973aa9 -[NSException raise] + 9
3 Foundation 0x000000010addc888 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 226
4 Foundation 0x000000010ad32997 -[NSObject(NSKeyValueCoding) valueForKey:] + 280
5 Foundation 0x000000010addca8c -[NSObject(NSKeyValueCoding) dictionaryWithValuesForKeys:] + 163

If I change the property name from ‘image’ to ‘imageUrl’, it does not crash anymore.

Hi,

I cannot reproduce this issue.
I just tried this code (in swift, but it does not matter):

    class ImageInfo : NSObject {
        
        var objectId : String?
        var image: String?
        var size: Int = 0
    }
    
    func saveNewImage() {
        
        let info = ImageInfo()
        info.image = "http://api.backendless.com/appId/publicUrl"
        info.size = 1587
        
        let dataStore = backendless.data.of(ImageInfo.ofClass())
        
        // save object synchronously
        var error: Fault?
        let result = dataStore.save(info, fault: &error) as? ImageInfo
        if error == nil {
            print("Info has been saved: \(result!.objectId)")
        }
        else {
            print("Server reported an error: \(error)")
        }
    }


Here is a result on dashboard of my backendless app:
http://support.backendless.com/public/attachments/649938748b4f394b020aa98613095ae4.png</img>

If you can see the property name ‘image’ of ‘String’ type successfully was saved in table.
Can you clarify how you get your result, add here some sample code, screenshots, and so on - help us to reproduce this problem.

Regards,
Slava

Hello Vyacheslav,

thank you for your time,

I created a minimalist project, isolating the core code, and I couldn’t reproduce the problem either.
I continued to work on the project since then, so it’s difficult to get back to the exact state the project was when I had the problem.

If I have to take an educated guess, I suppose I messed up with the object properties, probably in assigning an UIImage object to the string property. That would make sense if I read the log message.

I’m sorry if I took too much of your time with that, and thank you for your help !
regards,
l.