4

I'm coming over to Xcode from visual studio and am having some trouble inspecting or examining variables at my breakpoints.

Often times I'll try to examine an object by mouse-over and and expand out it's properties and I'll only see a hexadecimal representation of the attributes and nothing in the summary in a more human readable form. For example, the Facebook object in the Facebook sdk has an access token property that is an NSCFString. In the debugger how can I see the actual string value rather than the hex value for that attribute?

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

Also, why does it always say add to iTunes as a spoken track when I mouse over things in the debugger?

2 Answers 2

5

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

Print Object:

po objectName

Is probably the most used command to help you with debugger inside Xcode. Here's a roundup on GDB commands inside the Xcode debugger : Debugging tips for Objective-C programming

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

To me things are faster when I can just print the object and actually see what's going on every time I run the application:

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

Here are some tips on using NSLog with parameters: CocoaDev: NSLog

Downpoint: I have to clear out the NSLogs once the app is going to be released.


To your second rather odd iTunes question: Have you enabled accessibility mode on your Mac? (Just a guess, I have never come across something like that)

Sign up to request clarification or add additional context in comments.

1 Comment

On the down point, a tip I've come across in various places is to use: #define MyLog if(0); else NSLog while developing and change the 0 to a 1 for release. This prevents compilation of the NSLogs for release. I use this all the time now. Saves a lot of bother stripping out NSLogs.
0

Your iTunes question: Maybe you're accidentally picking up something from data tips.

I'm having trouble with data tips not working in OSX 5.1.1: hover doesn't display and there's no eye and info button. Instead, clicking on a variable drops down a menu that ends with Add to iTunes..., which is what I'm guessing you're seeing somehow.

I'm sorry I can't be clearer, but I haven't been able to figure out how this menu relates to data tips that don't work. I have posted a question on how to fix it (xcode 5.1.1 data tips fails in debugging), and if I get answers that apply to your question I will share them with you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.