Why does a subclass @property with no corresponding ivar hide superclass ivars?

后端 未结 2 1390
-上瘾入骨i
-上瘾入骨i 2020-12-06 10:57

The following seems simple enough. There\'s a superclass with an ivar, and a subclass which accesses the (@protected) superclasses ivar:

// Testclass.h    
@         


        
2条回答
  •  一整个雨季
    2020-12-06 11:53

    The testIvar undeclared error is actually red herring in this case. This message seems to be caused by testProperty not having a corresponding ivar. To resolve the issue either declare a testProperty ivar in TestSubClass.h or make testProperty @dynamic in TestSubClass.m.

提交回复
热议问题