Reputation: 41
There are 'conflicting parameter type in implementation...', as you can see in the image below. This code is working well, but the warning won't go away. Can someone explain what's going on here
In the .h file
@property (nonatomic) NSInteger score;
@property (nonatomic) NSInteger topScore;
In the .m file
-(void)setScore:(NSInteger *)score
{
_score = score;
scoreLabel.text = [[NSNumber numberWithInteger:(long)self.score] stringValue];
}
-(void)setTopScore:(NSInteger *)topScore
{
_topScore = topScore;
topScoreLabel.text = [[NSNumber numberWithInteger:(long)self.topScore] stringValue];
}
Upvotes: 0
Views: 2529
Reputation: 726809
This is because NSInteger
is a primitive type, not an object. It should be passed by value, not by pointer, i.e. without an asterisk:
-(void)setScore:(NSInteger)score {
_score = score;
scoreLabel.text = [[NSNumber numberWithInteger:(long)self.score] stringValue];
}
Same goes for setTopScore:
method.
Upvotes: 3