Does anyone know of a decent way to catch forget开发者_Python百科ting to use 'self.' when setting variables? Is there an xcode compiler setting that can trigger warnings? I'm trying to think of the easiest way to make ensuring there is a 'self.' in front of assignments foolproof.
The best I can suggest so far is to differentiate the ivar and property name, like:
@implementation Person
@synthesize firstName = firstName_;
@end
so it is harder to make mistake, though it is not foolproof.
精彩评论