Hey backendless team, hope you´re doing great.
I´ve the following class:
import Foundation
class Order: NSObject {
// MARK: Properties
var cart: String?
var price: Double?
var address: String?
var additional_details: String?
var phone: String?
var receptorName: String?
var id: Int?
}
Which im trying to save using this function:
func saveOrder(cart:[Int], price: Int, address: String, additional_details: String, phone: String, receptorName:String) {
let order = Order()
order.cart = cart.description
order.price = Double(price)
order.address = address
order.additional_details = additional_details
order.phone = phone
order.receptorName = receptorName
let dataStore = backendless.data.of(Order.ofClass())
// save object asynchronously
dataStore.save(
order,
response: { (result: AnyObject!) -> Void in
let obj = result as! Order
print(“Order has been saved: (obj.id)”)
},
error: { (fault: Fault!) -> Void in
print(“fServer reported an error: (fault)”)
})
}
The object saves everything(address, details, etc.) ok BUT the price. It´s just an empty double in my table.
I´ve checked with the debugger and the “order” object does have the correct price (a number) at the moment Im trying to save it.
Any ideas what could be happenning?