In Xcode, when you debug, you can't see the value of a variable directly, like Eclipse, or vs those integrated development. So how do you look at Xcode's variables while debugging?
There are some ways.
1. Create a new single View App
Add some code to the Viewdidload:
-(void) viewdidload{ [Super Viewdidload]; Nsdictionary *dic = [nsdictionary dictionarywithobjectsandkeys:@ "value1", @ "Key1", @ "+", @ "age", @ "Rongfzh", @ " Name ", nil]; UILabel *label = [[UILabel alloc] init]; Label.frame = CGRectMake (+, +, +); Label.text = [dic objectforkey:@ "name"]; [Self.view Addsubview:label];}
Make a breakpoint on the last line.
2. "Po": Print object is printed out by the Print Object command.
Command+r Debug Run, on the debug Console on the LLDB input po dic Enter, shown as follows:
This will print out the contents of the dictionary.
Try printing the label again.
(LLDB) PO Label
(UILabel *) $ $ = 0x06a8bdd0 <UILabel:0x6a8bdd0; frame = (20 40; 250 60); Text = ' Rongfzh '; Clipstobounds = YES; userinteractionenabled = NO; Layer = <CALayer:0x6a8be90>>
The label's information is also printed out.
3. Print command
Print (char*) [[dic description] cString]
(char *) $4 = 0x06d79760 "{\ n age = 28;\n Key1 = value1;\n name = rongfzh;\n}"
Prints the object's Retaincount, but the object is recycled
(LLDB) print (int) [Label Retaincount]
(int) $ = 1
IOS-----Xcode-debug Try