我在可转换字段中有一些加密的 NSString 存储。我需要解密并按字母顺序列出所有值。
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]
initWithKey:@"trans_word"
ascending:YES
comparator:^NSComparisonResult(id obj1, id obj2) {
NSString* s1 = [encryptObj decryptingfromValue:obj1];
NSString* s2 = [encryptObj decryptingfromValue:obj2];
NSLog(@"xxx");
return [s1 compare:s2];
}];
NSArray *sortDescriptors = [NSArray arrayWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
似乎该块没有性能。你能给我一些提示吗?谢谢!