-1

NSMutableDictionaryからキーの配列を作成し、アルファベット順に並べ替えようとしています。私が今持っているものは次のとおりです。

_currentItemsArray = (NSMutableArray *)[_currentItemsDict allKeys];
[_currentItemsArray sortUsingSelector:@selector(caseInsensitiveCompare:)];

しかし、それは例外をスローしています。具体的には:

-[__NSArrayI sortUsingSelector:]: unrecognized selector sent to instance 0x1e54ddb0

私の調査によると、それは_currentItemsArrayare notNSStringの値を意味するということです。NSMutableDictionaryしかし、ソースのキーがNSString'sである場合、それらは他に何になるでしょうか?

allKeysいずれにせよ、これは配列をアルファベット順にソートする最良の方法ですか?

4

4 に答える 4