Backedless 4.0.15
iOS/Swift
I’m trying to save my updated order object to the database and get the following error:
2017-10-14 19:22:29.263144 Yeti[876:180255] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSConcreteValue 0x174e457f0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key objCType.'
I’m using the same function to both create and update the object as described in the documentation:
"Updating a data object which has been previously stored in the Backendless data store can be done using the same API as for saving the object initially. "
When I use the function to create the object it works fine, when I try to update it I get the error. This is my create/update order function:
func createOrder(_ order: Order, completion: @escaping (Order?,Fault?) -> Void)
{
print("Begin create order service")
let dataStore = backendless?.data.of(Order.ofClass())
dataStore?.save(
order,
response: { (result: Any?) -> Void in
print("Create order response received")
let savedOrder = result as! Order
print("Order saved: \(savedOrder.userId)")
let user = self.backendless?.userService.currentUser
self.setUserOrderRelation(order: savedOrder, user: user!)
{
result, error in
if let result = result
{
print("Done")
completion (savedOrder, nil)
}
else if let error = error
{
print(error)
completion (nil, error)
}
}
},
error: { (error: Fault?) -> Void in
print("server reported error: \(error)")
completion(nil, error)
})
}
The error comes up as soon as datastore.save is executed.
App ID: B8F9484B-C42E-80FB-FFA6-B6DAC0B90900