Objective-c – property’s synthesized getter follows cocoa naming convention for returning ‘owned’ objects

naming-conventionsobjective cxcode

I curious is cocos2d have any naming convention for variable?

I have this

//.h
NSMutableArray *newRowForCounter;

and

//.m
@synthesize newRowForCounter;

and at @synthesize it's warning "property's synthesized getter follows cocoa naming convention for returning 'owned' objects" but if I change the name to something else it work fine.

I also try out variable naming begin with new- {EX newVariable…) it's still warn me that.

Thank

My gamma may look bad sorry about that

Best Answer

new cannot be used in the variable name at the beginning. That is why it shows the error.

Sol : declare a property whose name begins with new unless you specify a different getter:

// Won't work:
@property NSString *newTitle;

// Works:
@property (getter=theNewTitle) NSString *newTitle;

Explanations here and here