I've declared a Global Array/ Dictionary in Interface like below.
@interface ViewController ()
{
NSDictionary *dictionary;
NSArray *array;
}
I'm doing API calls and storing values in these array & dictionaries. I'd like to print the contents of the array/dictionary in LLDB during Runtime.
When i try to print these global variable, it gives me the following error.
(lldb) po assigneeArr
error: warning: Stopped in a context claiming to capture an Objective-C object pointer, but 'self' isn't available; pretending we are in a generic context
error: use of undeclared identifier 'assigneeArr'
error: 1 errors parsing expression
So how can i debug this globally declared variable??
Those aren't global variables; they are instance variables, so you need an instance of ViewController
before you can see their value.
Once you have the instance then it's as simple as using the ->
operator (vc
is the instance):
po vc->dictionary
Note: I would recommend using an underscore to prefix the names of instance variables in order to avoid confusion with parameters and local variables.
Finally resolved my issue by changing Enable Clang Module Debugging in Apple LLVM 7.1 Language Modules as following screen shot
Reference : https://stackoverflow.com/a/36176158/4014369
Please do below steps:
1. Press keyboard Command+Shift+y. It will open debug area for your project.
2. At right bottom of debug area you can find the icon of Trash. Near Trash icon you can find two options like Hide the variables view and Hide the Console. Both make on (It will display with blue border)
3. Put the break point on your ViewController
where you are using your dictionary / array.
4. You can find your dictionary / array value in Left side of your debug area.
5. Please do right click on your dictionary / array. you will be get first option i.e.Print description of dictionary / array.
6. After clicking on it you will get its whole value in console. (Right side of debug area)
Also you can refer below screen shot for the same.