I am sorting the results of a fetch request with a sort descriptor.
NSFetchRequest* req = [[NSFetchRequest alloc] initWithEntityName:[MyEntity entityName]];
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"property"
ascending:YES
selector:@selector(localizedCompare:)];
req.sortDescriptors = [NSArray arrayWithObject:descriptor];
return [self.managedObjectContext executeFetchRequest:req error:nil];
The problem is that words that start with non-English characters such as "İ" are listed at the end of the list. This is a Turkish letter, and the alphabet is as follows:
A, B, C, Ç, D, E, F, G, Ğ, H, I, İ, J, K, L, M, N, O, ..., P, R, S, Ş, T, U, x, V, Y, Z.
So, the letter is in the 12th position.
I do not know why, but using a comparator after the objects are loaded. Therefore, it works with any array, but not with a sort descriptor for querying a selection.