2015-08-25 37 views

回答

1

PFQueries只能按某些列中的值排序。因此,您可以使用「orderByDesecending」或「orderByAscending」(例如日期或按名稱的字母順序),但不存在「orderToMatchTheOrderOfMyArray」。

我會建議只是手動排序它們。它不應該很難。我不是一個快速的開發者,但這裏是僞代碼:

sortedObjects = [] //start with empty array 
for each ObjectId in MyListOfObjectIds { //loop through your ordered objectIds 
    for each object in MyQueriedObjects { //loop through the objects you got from the query 
     if (ObjectId == object.objectId) { //if you've found the correct object 
      sortedObjects.addObject(object); //add it to the list 
      break; //move on to the next ordered objectId 
     } 
    } 
} 
+0

你是一個英雄。我真的是在智慧的結尾,這非常聰明。我深深地感謝你 –

相關問題