Solved

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

Posted on 2011-09-18
2
749 Views
Last Modified: 2016-02-10
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
0
Comment
Question by:CBueche
2 Comments
 
LVL 5

Accepted Solution

by:
mad_mac earned 125 total points
ID: 36558963
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
 
LVL 1

Author Comment

by:CBueche
ID: 36563022
That sounds like the problem.  No time to verify right now, but I am in fact calling it up from a XIB.

Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

     Intro      In this article, I will show you how to parse a JSON in Swift using an open source library called SwiftyJSON (https://github.com/SwiftyJSON/SwiftyJSON). If you haven't heard of a JSON before, it stands for JavaScript Object Notation…
Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question