0
我想通過屬性「出發時間」的值來安排返回的核心數據實體,目前我有這個代碼,但順序沒有改變,它們被保存到相同的數組中無論NSSortDescriptor的順序如何爲NSArray訂購返回的CoreData實體
NSFetchRequest *request = [[NSFetchRequest alloc] initWithEntityName:@"Device"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"thetrip=%@",searchid];
[request setEntity:[NSEntityDescription entityForName:@"Device" inManagedObjectContext:managedObjectContext]];
[request setPredicate:predicate];
self.device = [[managedObjectContext executeFetchRequest:request error:nil] mutableCopy];
[NSSortDescriptor sortDescriptorWithKey:@"departtime" ascending:YES];
NSLog(@"the predicate is= %@", predicate);
NSError *error = nil;
NSArray *results = [managedObjectContext executeFetchRequest:request error:&error];
NSArray *areuslter=[self.device valueForKey:@"arriveairport"];
NSArray *areusltses=[self.device valueForKey:@"thetrip"];