I download some content from a json webservice.
Is it possible print the keys and not the values instead? For the eventuality of not knowing what the keys are.
for( NSString *aKey in [dictionary allKeys] )
{
// do something like a log:
NSLog(aKey);
}
OR
NSLog([dictionary allKeys]);
This should do the trick
You should be able to use the NSDictionary's keyEnumerator method to get the keys, then you can loop through them and print them out.
Borrowing an example from Apple:
NSEnumerator *enumerator = [myDictionary keyEnumerator];
id key;
while ((key = [enumerator nextObject])) {
NSLog(@"Do something with the key here:%@",key);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With