In my view controller I call with a reference to game, which is an istance of Game class
score.text = [NSString stringWithFormat:@"%d", [game score]];
Game has this:
int score
@property (nonatomic, readwrite) int *score ;
son normally score has a getter.
Game.h is included in ViewController.h
Why do I get “unrecognized selector sent to instance”?
Did you synthesize it in your implementation?
Also, you do not want a pointer to an int, but an int itself. Remove the ‘*’.
Thirdly, I’m assuming
score.textis setting the text for aUILabelor similar? And is different from Game’sscore.Another check you can use is to make use of dot-notation. If the property is not properly set, you will get an error rather than a warning. I.e.
game.scoreinstead of[game score].