我正在使用NSSet
进行排序:
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
[[testSet.questions allObjects] sortedArrayUsingDescriptors:descriptor]; // warning
但这会引起警告:
Incompatible pointer types sending 'NSSortDescriptor *__strong' to parameter of type 'NSArray *
最佳答案
您在需要数组的地方传递了单个描述符,请尝试以下操作:
[testSet.questions allObjects] sortedArrayUsingDescriptors:@[descriptor]];