It looks like the static analyzer parameter only works if you declare ivar in the header file.
This generates an analyzer warning correctly:
// AppDelegate.h @interface AppDelegate : NSObject <UIApplicationDelegate> { BOOL _foo; // never read or written } @end
None of them generate any analyzer warnings:
// AppDelegate.m @interface AppDelegate () { @private BOOL _goo; // never read or written } @end @implementation AppDelegate { @private BOOL _hoo; // never read or written } @end
So it looks like you cannot use modern syntax to keep ivars in a .m file if you want to check for unused ivars.
source share