How to Find Out the Content of a Dictionary when Debugging in Objective-c
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
A familiar function. Now there is this attributeDict object.
I wan开发者_如何学运维t to know what are all the keypairs in the object.
I go to expression window and see that it contain NSObject that contains a reference to ISA.
So what should I do? NSLog?
You can select "Print Description" in the context (right click) menu. Or in the debug terminal window you can type po variablename
. You can also, as you suggest, use NSLog
.
You can print contents of your dictionary to console, for example using NSLog in your code:
NSLog("%@", attributeDict);
Or while debugging place breakpoint in that method and type in debugger console:
po attributeDict
You can use NSLog(@"%@",attributeDict);
to print out the dictionary content.
If, for example, you have set a breakpoint and you are in GDB console you can use po attributeDict
that stand for print object and do the same thing as NSLog
精彩评论