Why doesn't breakpoint at local init() trigger in my UIViewController?

I have an iPhone app up and running on a physical phone.

I have my own subclassed implementation of a UIViewController, with init() and viewDidLoad() overridden and declared like this:

- (id)init;
- (void)viewDidLoad;

When I set breakpoints at init() and viewDidLoad() and run the app, gdb breaks at viewDidLoad(), but not init().  init() appears not to be called at all.  In fact, farther down in the execution, variables that are supposed to be assigned in init() are still unassigned.

Any thoughts?  Explanations?

- Thanks
LVL 1
CBuecheAsked:
Who is Participating?
 
mad_macConnect With a Mentor Commented:
2 things could be a factor here

1.  Are you programatically creating the view controller subclass or is it an object referenced from a XIB (NIB)..?  If it's the latter then you should be using -awakeFromNib to initialise variables.

2.  Normally a plain old init is not called, usually it is initWithNibName:bundle:

0
 
CBuecheAuthor Commented:
That sounds like the problem.  No time to verify right now, but I am in fact calling it up from a XIB.

Thanks!
0
All Courses

From novice to tech pro — start learning today.