问题
I am using Quickblox SDK in my Application and designed Custom Objects in the Quickblox Admin panel.Here i am having some complex relationship between Custom Objects and not able to figure out how to retrieve the records using the Quickblox API.
Problem:
There are two tables 1.User 2.Group, i am successfully fetching all the groups created by a specific using by using parent_id key as mention in Quickblox API for maintaining relationships between tables.
I want to retrieve all the groups created by the user and also the groups in which the user is added as a member which are created by other Users.How can i solve this? In my group table i am having a column that is an array of userIds to represent all the group members.
Can anyone tell me how to resolve this.How i can query and retrieve.I am really poor at DB knowledge and moreover Quickblox is a having different approach in the DB Design.
回答1:
NSMutableDictionary *getRequest = [NSMutableDictionary dictionary];
[getRequest setObject:user_id forKey:@“user_ids_column_name[in]"];
[getRequest setObject:user_id forKey:@"ParentID"];
QBRequestErrorBlock errorBlock = ^(QBResponse *response) {
NSLog(@"error: %@", response.error);
};
[QBRequest objectsWithClassName:@“Group” extendedRequest:getRequest successBlock:^(QBResponse *response, NSArray *objects, QBResponsePage *page){
NSLog(@"Success");
} errorBlock:errorBlock];
来源:https://stackoverflow.com/questions/36855064/retrieve-records-from-quickblox-api