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 trial
Adam Siwiec
12,070 Points2 BIG QUESTIONS
- what is wrong with this line of code:
-
(IBAction)buttonPressed {
int random = arc4random_uniform(self.predictions.count); self.prectionLabel.text = [self.predictions objectAtIndex:random];
How do I Archive in Xcode? The button to Archive is not "pressable". How do I fix this?
4 Answers
Lachlan Mitchell
9,278 PointsHey Tomek!
You need to add a dash before your method implementation to specify that it's an instance method and it seems you've spelt prediction in predictionLabel wrong. Also, you need to close the body of the method with a closing curly brace.
- (IBAction)buttonPressed {
int random = arc4random_uniform(self.predictions.count);
self.predictionLabel.text = [self.predictions objectAtIndex:random];
}
As for archiving, make sure you have an actual iOS device selected in the scheme menu. You can't archive using the simulator.
Hope that helps!
- Akyri
Adam Siwiec
12,070 PointsThanks helped alot
Adam Siwiec
12,070 PointsThanks helped alot
Adam Siwiec
12,070 PointsNow im getting this error :(" Implicit conversion loses integer precision: 'NSUInteger' (aka 'unsigned long') to 'u_int32_t' (aka 'unsigned int')"
Brett Doffing
4,978 PointsBrett Doffing
4,978 PointsAre you saying that buttonPressed should be hooked up to the Archive button, only the method is not firing when the button is pressed? Otherwise I'm not too sure what you mean by "Archive".