Error accessing generated ivars when I override setters and getters in Modern Objective-C

后端 未结 3 1283
猫巷女王i
猫巷女王i 2021-01-01 13:57

I know now the new Objective-C compiler lets you not need to synthesize your properties anymore. I have one file that has two classes in it. My .h for a simple helper clas

3条回答
  •  甜味超标
    2021-01-01 14:44

    If you override both the setter and the getter, the compiler will not automatically create the instance variable for you anymore. You can add it to your class implementation like so:

    @implementation ClassName {
        ViewFrameModel *_viewFrameModel;
    }
    ...
    @end
    

提交回复
热议问题