I am converting a Integer to a NSString, I have some code but I have 11 errors.
Here is the code I am using:
@interface GameViewController : UIViewController {
int score;
NSString *stringscore;
NSString stringscore = [NSString stringWithFormat:@"d",score];
}
How exactly can I fix these errors?
You left off the % in the format string, and you don’t need the second NSString
Although in this case you could have put the variable definition and assignment all on one line:
Stupidity update
In my frenzy to post (and being half asleep) I didn’t see that this was all being done in the @Interface.
If should be split between the interface and the implementation .. the following is an example of how it could be done: