为此,您需要获取所订购的事务。
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[NSEntityDescription entityForName:@"Transaction"
inManagedObjectContext:self.managedObjectContext]];
[fetchRequest setPropertiesToFetch :[NSArray arrayWithObjects:@"date", @"bankAccount", nil]];
[fetchRequest setSortDescriptors:[NSArray arrayWithObjects:
[[[NSSortDescriptor alloc] initWithKey:@"date"
ascending:YES
selector:@selector(compare:)] autorelease],
[[[NSSortDescriptor alloc] initWithKey:@"bankAccount.index"
ascending:YES] autorelease],
nil]];
我是这么想的
Transaction
是交易实体的名称
bankAccount
交易
BankAccount
.