使用断点记录字典中特定键的值

时间:2023-01-18 08:25:59

How to log the value of a particular key of dictionary using break points,

如何使用断点记录字典的特定键的值,

What i know is,

我所知道的是,

We can use NSLog and We can also log a message using @exp@ format (see attached image),

我们可以使用NSLog,我们也可以使用@ exp @格式记录消息(参见附图),

In my case, this (Value Of Title Key Is : @someRandomDictionary@, the command in popup) logs all the keys of dictionary, but i want to see only the value of particular key.

在我的例子中,这个(标题键的值是:@ someRandomDictionary @,弹出窗口中的命令)记录了字典的所有键,但我想只看到特定键的值。

使用断点记录字典中特定键的值

Is there any possibility to do so !

有没有可能这样做!

1 个解决方案

#1


1  

You could use the po (print object command) like so:

您可以使用po(print object命令),如下所示:

使用断点记录字典中特定键的值

The po command takes an arbitrary expression, that returns an object and prints it’s description in the console. In this case, it will print the value for the specified key, or nil in case it does not exist.

po命令采用任意表达式,返回一个对象并在控制台中打印它的描述。在这种情况下,它将打印指定键的值,如果不存在则为nil。

#1


1  

You could use the po (print object command) like so:

您可以使用po(print object命令),如下所示:

使用断点记录字典中特定键的值

The po command takes an arbitrary expression, that returns an object and prints it’s description in the console. In this case, it will print the value for the specified key, or nil in case it does not exist.

po命令采用任意表达式,返回一个对象并在控制台中打印它的描述。在这种情况下,它将打印指定键的值,如果不存在则为nil。