2015-08-25 36 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

你是一个英雄。我真的是在智慧的结尾,这非常聪明。我深深地感谢你 –

相关问题