Reputation: 12431
How can I retrieve all the keys (only) from a NSDictionary? I do not need them in any particular order.
Upvotes: 1
Views: 7485
Reputation: 8644
Use the allKeys
method on your NSDictionary
.
From the docs:
allKeys
: Returns a new array containing the dictionary’s keys.
- (NSArray *)allKeys
Return Value
A new array containing the dictionary’s keys, or an empty array if the dictionary has no entries.
Upvotes: 17
Reputation: 3051
I advise you to study the Dokumentation. ;-) Take a look here:
From the Dokumentation:
Returns a new array containing the dictionary’s keys.
- (NSArray *)allKeys
Return Value A new array containing the dictionary’s keys, or an empty array if the dictionary has no entries.
Discussion The order of the elements in the array is not defined.
Upvotes: 0