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!
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 trial

Alex Suarez
868 PointsHELP!! Using XCode 6.0.1 I get an alert, and my code won't randomize correctly!
Ok, here's part of my code (everything follows instructions as per the vids):
-(IBAction) buttonPressed {
int random = arc4random_uniform (self.predictions.count);
The alert message says:
Implicit conversion loses integer precision: 'NSUInteger' (aka 'unsigned long') to 'u_int32_t' (aka 'unsigned int)
When I run the simulator instead of getting a random number I always get 0 (zero). I've checked my code against the vids and everything coincides... And the code ran perfectly before the randomization.
2 Answers

Chris Shaw
26,663 PointsHi Alex,
Have a read of the below thread here on Treehouse which has the answer and explanation to fix this warning.
https://teamtreehouse.com/forum/nsuinteger-conversion-loses-integer-warning-message-in-xcode

Alex Suarez
868 PointsThank you. I understood the concept and made the changes.
Alex Suarez
868 PointsAlex Suarez
868 PointsOh I also get an error message after the build: Thread 1: breakpoint 1.1 2.1
And The build works if I change the self.predictions.count to a number (7 in this case)