Arun Stephens

Odd bug with inheritance and Objective C synthesized properties (with solution)

This is a weird one.

I have a class. And it has a subclass.

I kept getting error: 'psc' undeclared (first use in this function).

Strangely, it would only occur when compiling for the device. The simulator was fine. psc is an ivar of the superclass.

I did a bit of research and found the word @synthesize. I noticed that none of my other subclasses of that same class synthesized anything. I removed the synthesize statement. And it compiled. I put the synthesize statement back in, but this time with the backing ivar explicitly declared.

And it still worked.

I am not sure what the problem is, but this fixed it.