Hello,
I have this situation:
I have a class BidHistory which contains a string, a model BidItem, and an NSInteger.
class BidHistory : NSObject {
var userObjectID: String?
var bidParticipatedIn: BidItem?
var bidStatusDescription: NSInteger = 5 // 0 → lost, 1 → won, 2 → registered, 3 → tracked
override init() {
super.init()
}
}
When I want to add a new object to BidHistory, I get this : FAULT = ‘1007’ [Unable to save object - invalid data type for properties - isDefault. You can change the property type in developer console.] <Unable to save object - invalid data type for properties - isDefault. You can change the property type in developer console.>
If I remove from the console the field “bidParticipatedIn”, I can save an item without any problems.
This is my function for saving a BidHistory:
static func addBidToHistoryOfCurrentUser(userObjectID: String?, bidItem: BidItem?, bidDescription: Int, completionHandler: SLBackendlessAddBidToHistoryResponse)
{
let aBidHistory = BidHistory()
aBidHistory.userObjectID = userObjectID
aBidHistory.bidParticipatedIn = bidItem!
aBidHistory.bidStatusDescription = bidDescription
Backendless.sharedInstance().data.of(BidHistory.ofClass()).save(aBidHistory, response: { (responseObject) in
if responseObject != nil {
print(responseObject)
} else {
}
}) { (fault) in
print(“Error on saving bid to bidHistory: (fault)”)
}
}
I have attached the table schema from Backendless.
Thank you!
Please provide your BidItem class and your appId - here or to support@backendless.com. We need to reproduce this issue with your data.
I’ve sent you an email with the details you required. It’s a little bit urgent. Thank you in advance!
To be clear: if I make a new BidItem, I can add it there, but I want to add an existing one and in this situation I get that error
Hi Isabela,
First, please update the latest Backendless SDK via pod (3.0.30 release) or from ios-SDK github (CommLibiOS & backendless) - and we all will work with the same SDK.
Second, your data structure has many relations, we recently fixed some bugs with them, so check your app, maybe it will be all right?
If no, you should provide to us an additional code to support@backendless.com.
To reproduce the issue we need the all your data model classes associated with BidItem class:
AppCategory
BidActivity
SabmittedItem
BidItems
BidsType
Category
BarCode
Location
Promoter
ContractImage
PromotionItem
PromotionImage
And if you got this fault saving the concrete BidItem object from your app, please provide its objectId.
Regards,
Slava
Ok, I’ll update and keep you in touch. Thank you!
Isabella,
First, you must remove or rename all “description” properties in your data model classes, they are the conflicts with NSObject description method.
Second, isDefault field in Category table and IntStartDate field in BidItem table were broken, I’ve fixed them. You have to declare the boolean properties, for example:
var isDefault : Bool = true
I just created a sample project, which save BidHistory object with existing BidItem object, I sent you it by email.
Thank you, I received it. I sent you back an email with the same problem for one bid item… I think we do something wrong when we add a new bid item… but I don’t know exactly what… It works for the bid test included in the demo project, but with a new bid item I’ve created it still doesn’t work.
The problem is in IntStartDate field in BidItem table - an associated class property is absent. How do you set it?
I think the problem is in usage NSNumber? for numeric properties of your data model classes.
The best practice is to use:
class TestNumerics : NSObject {
var logic : Bool = false
var count : Int = 0
var real : Double = 0.0
var afloat : Float = 0.0
}