I’m developing an iPhone 4 application and I having problems with the class:
@interface Pattern : NSObject {
int maxNumShapes;
NSMutableArray* shapes;
NSMutableArray* shapeMatched;
CGSize bounds;
}
@property (nonatomic, retain, readonly) NSMutableArray* shapes;
@property (nonatomic, retain, readonly) NSMutableArray* shapeMatched;
...
- (void) setShapeMatched:(ShapeType)type;
@end
And its implementation:
- (void) setShapeMatched:(ShapeType)type {
int index = 0;
if (shapes != nil)
{
for(Object2D* obj in shapes)
{
if (obj.figure == type)
{
[shapeMatched replaceObjectAtIndex:index
withObject:[NSNumber numberWithBool:YES]];
obj.withFillColor = YES;
break;
}
else
index++;
}
}
}
I get the following warning:
Type of property 'shapeMatched' does not match type of accessor 'setShapeMatched:'
How can I fix this warning?
You need to rename your custom
setShapeMatched:to something else (likesetMyShapeMatched).setShapeMatched:is already in use as the setter for your declared property.