Beautify NSLog of NSArray & NSDictionary

iOSDevil picture iOSDevil · Aug 19, 2011 · Viewed 41.6k times · Source

I'm dealing with deeply nested NSArray's and NSDictionary's and it's very time consuming to say the least. [data objectatindex:0] valueForKey:@"blah"] etc etc

Does anyone know of a nice iOS category to recursively log the structure, highlight the type and show the values?

Might be asking a bit much but you never know :)

Answer

Andrey Starodubtsev picture Andrey Starodubtsev · Apr 29, 2013

Hmm. Simple

NSLog( @"%@", dictionaryYouWantToPrint );

outputs following result for me:

{
    id = 1;
    matchCount = 0;
    matchPattern = abcdef;
    number = "123456";
    sessionID = 5;
    status = Unknown;
    timerStart = 1367229348;
}