Objective-C: looking inside NSDictionary

Member
Posts: 142
Joined: 2009.11
Post: #2
For whatever reason the data structure browser doesn't work for me when using method arguments. You can, however, print it to the debugger console by right-clicking on it in the debugger window:

[Image: upshot_printToConsole.png]

Code:
Printing description of info:
<CFBasicHash 0x5a51420 [0x17c93e0]>{type = immutable dict, count = 2,
entries =>
    0 : <CFString 0xcbae8 [0x17c93e0]>{contents = "username"} = <CFString 0x5a582f0 [0x17c93e0]>{contents = "*******"}
    2 : <CFString 0xcbba8 [0x17c93e0]>{contents = "password"} = <CFString 0x5a35de0 [0x17c93e0]>{contents = "*******"}
}
(gdb)

You can also use various debugger commands in the console, which behaves using the current context for the breakpoint:

Code:
(gdb) po info
{
    password = *******;
    username = *******;
}

From this context, you can also use more advanced things, even call methods:

Code:
(gdb) po [info allKeys]
<__NSArrayI 0x588f090>(
username,
password
)

FWIW, your root problem is probably that you're mis-typing the key that you want. Using po [info allKeys] (replacing info with the name of your NS(Mutable)Dictionary, you should see the problem fairly quickly.

HTH.

Everyone's favourite forum lurker!
http://github.com/NSError
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Objective-C: looking inside NSDIctionary - cmiller - Nov 29, 2010 02:16 PM