我已經做了一些實驗由我已經整理,我們只能查詢高達第二級,如果我們去第三級,然後我們將得到異常。這是我正在做的。
PFQuery *Table4Query = [PFQuery queryWithClassName:@"Table4"];
[vehicleTypeQuery whereKey:@"name" equalTo:@"A"];
PFQuery *Table3Query = [PFQuery queryWithClassName:@"Table3"];
[vehicleQuery whereKey:@"Table4PointerColumn" matchesQuery:Table4Query];
PFQuery *Table2Query = [PFQuery queryWithClassName:@"Table2"];
[Table2 whereKey:@"Table3PointerColumn" matchesQuery:Table3Query];
PFQuery *Table1Query = [PFQuery queryWithClassName:@"Table1"];
[query whereKey:@"Table2PointerColumn" matchesQuery:Table2Query];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
{
}
,我得到了錯誤
「查詢有太多的嵌套查詢」
然後我嘗試這一點。
PFQuery *Table3Query = [PFQuery queryWithClassName:@"Table3"];
[vehicleQuery whereKey:@"Table4PointerColumn" equalTo:[PFObject objectWithoutDataWithClassName:@"Table4" objectId:@"kVQvan1E23"]];
PFQuery *Table2Query = [PFQuery queryWithClassName:@"Table2"];
[Table2 whereKey:@"Table3PointerColumn" matchesQuery:Table3Query];
PFQuery *Table1Query = [PFQuery queryWithClassName:@"Table1"];
[query whereKey:@"Table2PointerColumn" matchesQuery:Table2Query];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
{
}
這對我來說是完美的,現在我只需要查詢Table4以獲取數據。
你說他們是指針,但是你說你想要所有的東西基本上是不可能的,因爲指針意味着1對1的關係。更確切地說:如果它是1 - > 2 - > 3 - > 4,這很容易,但如果它是一棵樹(具有關係而不是指針)並且每個節點具有多個分支,則更困難 –
Btw,on你想要哪個操作系統? Android或iOS –
偏好是iOS,但我不認爲兩個平臺都會有任何更改。 –