Attualmente anche se lo faccio orderByAscending non lo fa mai in ordine ascendente. Qual è il problema che non vedo? Sto usando ParseCome interrogare in Crescente usando Parse
PFQuery *foodList = [PFQuery queryWithClassName:@"Food"];
[foodList whereKey:@"date" greaterThanOrEqualTo:minimumDate];
[foodList whereKey:@"date" lessThan:maximumDate];
[foodList orderByAscending:@"expiration_date"];
[foodList findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
}];
Esempio
food_name expiration_date
Apple 1/2/15
Banana 1/2/15
Pear 1/3/15
Kiwi 1/1/15
uscita
Le uscite sarebbero molto casuale. Suppongo che l'elenco non venga ordinato mentre sta interrogando. Non sono sicuro di come risolvere questo problema.
Puoi uscita il risultato che si vede? –
@AndriyGordiychuk L'output è in ordine casuale. – user3281743
Il codice che hai inserito qui funziona? Penso che la sintassi orderByAscending manchi la @ davanti alla stringa. Dovrebbe essere [foodList orderByAscending: @ "expiration_date"]; – Rufus