Skip navigation

Xcode debugger not showing my instance variables!!

1384 Views 8 Replies Latest reply: May 13, 2011 3:29 PM by xnav RSS
Chap Harrison Level 1 Level 1 (115 points)
Currently Being Moderated
May 13, 2011 12:48 PM

I hate asking questions like this.


I set a breakpoint in an IBAction method 'pushed:' inside FooViewController.  At runtime I pressed a GUI button and processing stopped in pushed:.


In the data-viewing pane of xcode, I see



self = (FooViewController *) 0x... etc.



Indented under this is



UIViewController = (UIViewController) { ...



Nowhere do I see any of my instance variables!!


Now, they were synthesized from properties, but that doesn't matter, does it?


The code that proceeds to set some instance variables runs fine.


Why isn't xcode displaying self's instance vars?




  • xnav Level 5 Level 5 (6,625 points)

    In the Debugger Nav window (Xcode4) or Debug window (Xcode3) use the caret next to 'self' to expand the list of ivars.

  • xnav Level 5 Level 5 (6,625 points)

    It appears as if you really don't have any ivars!  Let's see your .h.

    One ivar 'crash' here:


  • xnav Level 5 Level 5 (6,625 points)

    Try doing it like this:

    #import <UIKit/UIKit.h>
    @interface CrashViewController : UIViewController {
                        IBOutlet UITextField *crash;
    @property (nonatomic, retain)  UITextField *crash;
    Mac Pro, Mac OS X (10.6.7)
  • xnav Level 5 Level 5 (6,625 points)

    If you don't change your header then in the debug variable area right click on 'self' and select "Add Expression", then enter e.g.' _wordLength' and the ivar will be displayed.

  • xnav Level 5 Level 5 (6,625 points)

    That's just the way it is with dynamic ivars, they like to be hidden!  I never use them since I started Obj-C coding before they were dreamed up.


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.