Tips for viewing variables or examining objects in Xcode debugging

I am switching to Xcode from visual studio, and I have some problems with checking or analyzing variables at my breakpoints.

Often I try to check an object with the mouse and extend its properties, and I will see only a hexadecimal representation of the attributes and nothing in the summary in a more readable form. For example, the Facebook object in Facebook sdk has an access token property, which is NSCFString. In the debugger, how can I see the actual string value, rather than the hexadecimal value for this attribute?

Are there any very useful gdb commands that I should use in the debug window?

Also, why does he always say that add iTunes as an oral track when I mouse over things in the debugger?

+4
source share
2 answers

As you pointed out, there are some GDB teams to enlighten your life.

Print Object:

po objectName

Perhaps the most commonly used command helps you debugger inside Xcode. Here's an overview of GDB commands inside the Xcode debugger: Debugging Tips for Objective-C Programming

Personally, I kind of rely on old-fashioned print statements using NSLog. It really is a pain to use GDB commands all the time.

For me, it's faster when I can just print the object and see what happens every time the application starts:

NSLog(@"%@", [info valueForKey:key]); 

Here are some tips for using NSLog with options: CocoaDev: NSLog

Downpoint: I have to clear NSLogs as soon as the application is released.


To your second rather odd iTunes question: Have you activated accessibility mode on your Mac? (Just guessing, I've never come across anything like this)

+5
source

Your question on iTunes: You may have accidentally typed some of the data hints.

I am having problems with data recommendations that do not work in OSX 5.1.1: the hang does not appear, and there is no eye button and information. Instead, clicking on a variable resets the menu, which ends with adding to iTunes ... which I assume you are seeing.

Sorry, I could not be more clear, but I could not understand how this menu relates to data tips that do not work. I raised the question of how to fix it (during the debugging process, xcode 5.1.1 data verification fails), and if I get answers that relate to your question, I will share them with you.

0
source

All Articles