How can I get the object property of the returned inner query's object in one query with includeKey feature
-
21-12-2019 - |
题
I am trying to make a query that can search the store product with the current store and the product code. And the product include a "category" object property I need.
I use the following query but it always returns the store product and its product object property but not includes the category object property.
PFQuery *query = [StoreProduct query];
// Inner Query
PFQuery *productQuery = [Product query];
[productQuery includeKey:@"categoryObject"]; // there is no need and it's not working but I tried
[productQuery whereKey:@"code" equalTo:@(_number)];
[query whereKey:@"productObject" matchesQuery:productQuery];
[query whereKey:@"storeObject" equalTo:_currentStore];
[query includeKey:@"productObject"];
[query includeKey:@"productObject.categoryObject"]; // this is not working
Does anyone has idea? Thanks.
解决方案
The function can do request 2 deep. The answer from Parse help forum: https://parse.com/questions/how-can-i-get-the-object-property-of-the-returned-inner-querys-object-in-one-query-with-includekey-feature
Just be aware of the property names of custom subclass on iOS should be mapped to the columns of object table on Parse cloud side.
不隶属于 StackOverflow