iOS*_*vil 40 nsdictionary nsarray ios
我正在处理深度嵌套的NSArray和NSDictionary,而且至少可以说它非常耗时.[data objectatindex:0] valueForKey:@"blah"]等等
有没有人知道一个漂亮的iOS类别,以递归方式记录结构,突出显示类型并显示值?
可能要问一点但你永远不知道:)
And*_*sev 128
嗯.简单
NSLog( @"%@", dictionaryYouWantToPrint );
Run Code Online (Sandbox Code Playgroud)
输出结果对我来说:
{
id = 1;
matchCount = 0;
matchPattern = abcdef;
number = "123456";
sessionID = 5;
status = Unknown;
timerStart = 1367229348;
}
Run Code Online (Sandbox Code Playgroud)
Got*_*chi 48
也许是这样的?
for (id key in dictionary) {
NSLog(@"key: %@, value: %@ \n", key, [dictionary objectForKey:key]);
}
Run Code Online (Sandbox Code Playgroud)
但我想不出任何好的方法来获得输出漂亮,除了将其复制并粘贴到jsonFormatter(例如)
编辑:@Andrey Starodubtsev有以下XCode> 5.x的解决方案:
NSLog( @"%@", dictionaryYouWantToPrint );
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
39593 次 |
最近记录: |