I hava a core data application. And I want to fetch one kind of object, User
. User
have the property userId
.
I have another a
Use this idea which i use to sort message id if it is added to DB
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"message_id" ascending:NO selector:@selector(localizedStandardCompare:)];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[request setSortDescriptors:sortDescriptors];
request.returnsObjectsAsFaults=NO;
NSError *error = nil;
NSArray *results = [managedObjectContext executeFetchRequest:request error:&error];