How to fix the warning of “Autosynthesized property 'myVar' will use synthesized instance variable '_myVar', not existing instance variable 'myVar' ”?

前端 未结 1 1835
情书的邮戳
情书的邮戳 2021-01-01 21:43

I declare my .h file like this:

#import 

@interface NavigationTripViewController : UIViewController 

        
相关标签:
1条回答
  • 2021-01-01 22:02

    Edit: Basically for all intents and purposes you should be building on a new enough XCode to use the new behavior, in that solution you typically will just remove the ivar from the @interface block in the .h file... If for some reason you do need to access an ivar directly you can now declare it in the @implementation block... and use @synthesize var or @synthesize var=_var

    OGPost:

    to make that go away you can go all new school and drop the iVar, or you can go all old school and add an @synthesize someIvar in your @implementation block.

    0 讨论(0)
提交回复
热议问题