Exception when saving object

When I try to save the object to the server, I get this exception: “this class is not key value coding-compliant for the key CGImage”

Saving code:

func setupProfile() {
let request : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: “me”, parameters: [“fields”: “picture.type(large), gender”])

request.start(completionHandler: { (connection, result, error) in
let info = result as! NSDictionary
let profile = Profile()

profile.facebookId = self.facebookId
profile.nickname = self.fullName
profile.gender = (info[“gender”] as! String == “female” ? 0 : 1);

let pictureUrl = ((info[“picture”] as! NSDictionary)[“data”] as! NSDictionary)[“url”] as! String

self.fetchFile(url: URL(string: pictureUrl)!,
onSuccess: { (data) in
DispatchQueue.main.async {
profile.setProfileImage(image: UIImage(data: data)!,
onSuccess: {
print(“successfully uploaded facebook profile picture”)
self._backendlessUser.setProperty(User.PublicProfileField, object: profile)
self.save()
},
onFailure: { (error) in
print(“failed to upload facebook profile picture: (error)”)
})
} // Dispatch.main.async
},
onFailure: { (error) in
print(“error fetching profile picture”)
})
}) // request.start
}
func save()
{
self.saveUser(onSuccess: {
}) { (Error) in
}
}

private func saveUser(onSuccess : @escaping ()->(), onFailure : @escaping (Fault)->())
{
let dataStore = self.backendless.data.of(BackendlessUser.ofClass())
dataStore?.save(_backendlessUser,
response: { (any) in
print(“successully saved user (self)”)
onSuccess()
},
error: { (error) in
print(“failed to save user (self): (error)”)
onFailure(error!)
})
}

Hello Peter,

Please provide your application ID and I’ll check.

Regards,
Olga

it’s

2D5792E2-DD5A-566C-FFD7-5849E1F8C300

Hi Peter,

Are you trying to save CGImage object into the data service?

hi! no - i was trying to save BackendlessFile once it was uploaded. nevertheless, I somehow overcame the problem through a little bit of refactoring. previously, I had object relationship to BackendlessFile table but now I just added column to my object which is BackendlessFile reference (i suppose it’s just a string, right?).

now, i don’t experience this problem anymore.