Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
So, in object A, I have a property called "objectB" whose getter is overridden so that it returns a property (parentObject) of another object (element). There seems to be a point within my app wherein the objectB property getter returns nil, even though at that point parentObject is not nil. Here's the getter code:
Edit: Does it matter if the reference to object B is weak?
Code:
-(ElementObject *)objectB

{

    return [self.element parentObject];

}
 
Last edited:
Set a breakpoint. Step through it.
I set a breakpoint in the posted method, and the program did not stop.

Edit #2: The property in question is declared in a superclass, but is synthesized in a subclass. However, the subclass does not set the property, and at the aforementioned point in time, a superclass method is being used.
 
Last edited:
If the breakpoint isn't working then that piece of code isn't getting called. Please post more of your code, what you posted is literally useless.
 
If the breakpoint isn't working then that piece of code isn't getting called.
This can be confirmed by adding a call to the C function abort() in the method, or one can @throw an exception object. The goal is to have code that can't possibly proceed. Then run the app and see if the abort or exception occurs. If it doesn't, then that's reliable evidence that the code isn't executing, rather than a debugger malfunction.
 
Unfortunately, @Dookieman @KarlJay what you said about my code is not true. The calling code absolutely has to be running, because I can set a breakpoint on the calling code and it fires.

Update: I threw an abort() statement in the method I posted, and the program aborted.
 
Last edited:
So you override the getter, did you make a call to Super? (the super getter)
You say it gets called but it's nil.
It looks like either it's getting called later than you access it, or it's returning nil.

Is that right?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.