我有三個解析子類:Recipe,Ingredient和RecipeIngredient。 RecipeIngredient有一個指向食譜的指針和一個指向成分的指針。ParseQueryAdapter鍵匹配爲空Android
當我試圖創建一個QueryFactory來獲取配方的所有成分。我試圖用whereMatchesKeyInQuery來做到這一點,但objectIds不匹配。從文檔看來,這應該是合法的。我錯過了什麼?
public MeatIngredientListAdapter(Context context, final String recipeName) {
super(context, new ParseQueryAdapter.QueryFactory<Ingredient>() {
public ParseQuery<Ingredient> create() {
ParseQuery<Ingredient> query = ParseQuery.getQuery(Ingredient.class);
query.whereEqualTo("isMeatOrFat", true);
ParseQuery<RecipeIngredient> riQuery = ParseQuery.getQuery(RecipeIngredient.class);
riQuery.whereEqualTo("recipeName", recipeName);
riQuery.include("ingredient");
riQuery.whereEqualTo("isMeatOrFat", true);
query.whereMatchesKeyInQuery("objectId", "ingredient.objectId", riQuery);
return query;
}
});
}
你能解釋子查詢的目的嗎?我不清楚食譜配料應該做什麼,以返回成分 – cYrixmorten