我正在编码,并遇到了这个问题。
我不明白为什么会这样,我需要帮助,有人可以帮忙吗? :)
- (void)viewDidLoad
{
Start = YES;
Obstacle.hidden = YES;
Obstacle2.hidden = YES;
Bottom1.hidden = YES;
Bottom2.hidden = YES;
Bottom3.hidden = YES;
Bottom4.hidden = YES;
Bottom5.hidden = YES;
Bottom6.hidden = YES;
Bottom7.hidden = YES;
Top1.hidden = YES;
Top2.hidden = YES;
Top3.hidden = YES;
Top4.hidden = YES;
Top5.hidden = YES;
Top6.hidden = YES;
Top7.hidden = YES;
Heli.center = CGPointMake(48, 145);
HighScore = [[NSUserDefaults standardUserDefaults] integerForKey:@"HighScoreSaved"]; < issue HERE
Intro3.text = [NSString stringWithFormat:@"High Score: %i", HighScore];
最佳答案
integerForKey
返回NSUInteger值(又名无符号长)。我假设您的HighScore变量是一个int,其字节数少于一个long。尝试转换为int:
HighScore = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"HighScoreSaved"];
关于ios - 隐式转换在制作应用时将整数精度'NSUInteger'(aka'unsigned long')转换为'int'吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22951810/