Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Debugging not showing values

I'm completely stumped. I've been debugging for over a year and have only had this problem when the Build Configuration was set to Release. I have the Build Configuration set to Debug and I have checked to be sure I am attaching to the correct process and yet I still cannot see the values while stepping through the code. Has anybody else ran into this issue?

Here is a screen shot:

enter image description here

The value is returning, but I am unable to see the values of ANYTHING in this method or any of the other methods and I cannot figure out why.

Thank you for any hints you can give me.

============================== UPDATE ==================================

I've tried to print out the valued and this is the output I receive:

enter image description here

Notice though, that the value in the Variables view is correct for the result, even though I can't print it out. But the other values, like filePath should not be nil.

This is so weird.

============================== UPDATE ==================================

I put the breakpoint on the return statement and still no luck:

enter image description here

This time I see no value for result:

enter image description here

like image 522
Patricia Avatar asked Jun 05 '14 16:06

Patricia


People also ask

How do I enable debug mode in Xcode?

Enabling Debug Mode To get to the developer console, go to the wrench icon in the top navigation bar of the dashboard and select "Developer Console" from the drop down. This setting also enables logging to the Xcode console. Tapjoy. setDebugEnabled(true);

How do you debug an Xcode project?

When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.

How do I see console in Xcode?

Here is small tip for Xcode developers. To show/hide the Console click the icon Show/Hide the console in the lower right corner. It's the last icon on the lower right side of the panel.


2 Answers

I was facing the same issue, On mouse hover and watch section for every variable it was showing nil value but while NSLog for those variables it was printing correct value.

now it's fixed. Try this

Go to Product menu > Scheme > Edit scheme or +<

In Run go to Info tab, change the build configuration to "debug". Hope it will work.

Follow the same

like image 134
Sujay Avatar answered Sep 27 '22 00:09

Sujay


@Lucy, ideally you shouldn't have to run in Release profile when debugging, Release is meant as an App Distribution profile with a small package size and little / no debug symbols.

But if you must debug on Release (e.g. due to Environment, data reasons), make sure you have the Optimization Level set to 'None' for Release.

Optimization level

You can reach the config above through:

1) Project wide settings - affects all Targets project wide

2) Target specific setting - affects a single Target only Target specific

Don't forget to switch this back before App Store distribution. Lower Optimization will generate a larger ipk increasing your users' download time - also the potential dSYM generated.

Background

For context, Debug, Adhoc or Release profiles are purely to id different build configurations that XCode ships with. XCode starts projects with a Debug profile with no Optimization (and various other predefined config related to development & debugging), so symbol loading by the interpreter is possible - you're free to tweak this however you wish.

Theoretically able to establish a Release build profile that's identical to Debug.

like image 31
snowbound Avatar answered Sep 26 '22 00:09

snowbound