Saturday 15 March 2014

nsmutablearray - iOS - What exactly does allKeys: return in an NSArray, and how to alphabetize? -


I'm trying to create an array of keys from a NSMutableDictionary , and then click it Sort alphabetically What I just got:

  _currentItemsArray = (NSMutableArray *) [_ currentItemsDict allKeys]; [_currentItemsArray sortUsingSelector: @selector (Case Incentive Compaire :));   

But this is throwing an exception. Specifically:

  - [__NASRRI sorting selector:]: 0x1e54ddb0 sent to the unknown selector for example   

My research is telling me that This means that _currentItemsArray is not NSString 's NSString ' s

and in any way , Is this the best way to sort a all of array alphabetically?

You can have your currentItemsArray to an NSArray Pointer NSMutableArray Indicator An NSMutableArray, but any amount (NSMutableArray *) entered can make NSArray unstable, you must use NSArray methods: NSArray * array = [[_currentItemsDict allKeys] SortedAreasy user: @Selector (if any)];

No comments:

Post a Comment