打印NSDictionary的键而不是值

bru*_*uno 8 printing json key nsdictionary ios

我从json webservice下载了一些内容.

是否可以打印键而不是值?因为不知道密钥是什么的可能性.

Man*_*uel 33

for( NSString *aKey in [dictionary allKeys] )
{
    // do something like a log:
    NSLog(aKey);
}
Run Code Online (Sandbox Code Playgroud)

要么

NSLog([dictionary allKeys]);
Run Code Online (Sandbox Code Playgroud)

这应该可以解决问题

  • 或者只是`NSLog(@"%@",[字典allKeys])` (3认同)