我收到错误:
nested functions are disabled, use -fnested-functions to re-enable.
可能是一种语法。我只是无法绕过它。
- (NSArray *)sortedVariants {
NSInteger alphabeticSort(id object1, id object2, void *reverse) {
if ((NSInteger *)reverse == NO) {
return [[object1 name] localizedCaseInsensitiveCompare:[object2 name]];
}
return [[object2 name] localizedCaseInsensitiveCompare:[object1 name]];
};
return [variants sortedArrayUsingFunction:alphabeticSort context:NULL];
}
@end