Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLeon Gaban
922 Points'NSUInteger conversion loses integer' warning message in XCode
I'm not sure how to remove this warning message. I found numerous questions on stackoverflow relating to the same warning message, however still really stuck here, any tips?
It's a warning attached to the predictionArray
- (IBAction)buttonPressed:(UIButton *)sender {
//NSString *myString = @"It is decidely so";
//self.predictionLabel.text = @"Definately yes";
NSUInteger index = arc4random_uniform(predictionArray.count);
self.predictionLabel.text = [predictionArray objectAtIndex:index];
}
3 Answers
Amit Bijlani
Treehouse Guest TeacherExcellent explanation on StackOverflow!
Fernando Boza
25,384 PointsHey man I have the same issue, any solutions ?
Amit Bijlani
Treehouse Guest TeacherBasically you need to convert the count. If you want an explanation then please see the link Leon posted above.
NSUInteger random = arc4random_uniform((uint32_t) self.predictions.count);
Fernando Boza
25,384 Pointsmerci beaucoup !