Error message: Method ‘description()’ with Objective-C selector ‘description’ conflicts with getter for ‘description’ from superclass ‘NSObject’ with the same Objective-C selector
Great, thanks. I worked around with the tutorial. I know right know, how I create a relationship between box and Card. But how would I do that between User to Box?
Pascal, have you tried debugging the code? I think reviewing the code for the users is okay to a certain point, but here, with 80 lines of code, that’s a bit too much, don’t you think? We’d love to help, but to make this process scale, we really need you to try solving the problem first and then come to us for help.
I got it!!!
Mark, would it not be easier to have two tables called “Users” and “Cards”. I have a relationship (one to many) form my “Users” table to “Cards”. “Cards” does have a column called “name” and two “Array column” called" firstLanguage", “secondLanguage”. It would be easier for me to retrieve an array and handle with it then with a “Box Column” step. Or does Backendless not support arrays?
Ok, but that means actually by 1 Mio. users, each user have 20 boxes with around 20 cards = 400000000 cards. Is that correct and possible? I know right now how to save data with relation how can I right now retrieve this objects? I found some code, but with it I retrieve all cards:
func searchingDataObjectByDistance() {
Types.tryblock({ () -> Void in
let queryOptions = QueryOptions()
queryOptions.relationsDepth = 1;
let dataQuery = BackendlessDataQuery()
dataQuery.queryOptions = queryOptions;
let cards = self.backendless.persistenceService.find(Card.ofClass(),
dataQuery:dataQuery) as BackendlessCollection
for card in cards.data as! [Card] {
let info = card.firstLanguage! as String
print(info)
}
},
catchblock: { (exception) -> Void in
print("searchingDataObjectByDistance (FAULT): \(exception as! Fault)")
})
}
Pascal, if you don’t need to load all relations, you can use ‘filtring tools’ of the query, for example: queryOptions.related - allow you to load only said relation, dataQuery,whereClause - sql-style filter. These features are described in Data documentation - see the examples are there.
Since Slava answered the filtering question, I’ll respond to his:
Ok, but that means actually by 1 Mio. users, each user have 20 boxes with around 20 cards = 400`000`000 cards. Is that correct and possible?
I do not see anything wrong with it. With your original approach (table per user), you’d have 1 million tables with arrays of languages for every card. Either way it is a lot of data, however, the first approach provides a more normalized data view.
Orders have been retrieved: [<BackendlessEntity> objectId: '0E0965CE-21E6-132B-FF71-6384136A2400' meta: '{"relationRemovalIds":{},"selectedProperties":["created","name","___class","ownerId","updated","items","objectId"],"relatedObjects":{"items":["AFD4B66F-50CB-0A53-FF73-A969F0B82400","B4274CE8-9BA9-C94D-FF96-9248DF9C7E00"]}}']
How can I right now filtering this code for the name in Manufacturer?
The sample in tutorial simply shows how you can retrieve the related objects.
So, if you have data model classes like these:
class Order : NSObject {
var objectId : String?
var name : String?
var items : [Item]?
}
class Item : NSObject {
var objectId : String?
var itemName : String?
var unitPrice = 0.0
var manufacturer : Manufacturer
}
class Manufacturer : NSObject {
var objectId : String?
var name : String?
var phone : String?
var address : Address?
}
you can retrieve all objects from Order table with them Item objects (1:N relation) and Item’s Manufacturer object (1:1 relation) using code from tutorial.
What data model classes did you use? Did you set ‘items’ property of your Order object?
Can you add here your whole code? - we try to reproduce this problem.