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

iOS

2 BIG QUESTIONS

  1. what is wrong with this line of code:
  2. (IBAction)buttonPressed {

    int random = arc4random_uniform(self.predictions.count); self.prectionLabel.text = [self.predictions objectAtIndex:random];

  3. How do I Archive in Xcode? The button to Archive is not "pressable". How do I fix this?

Are 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".

4 Answers

Hey 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

Thanks helped alot

Thanks helped alot

Now im getting this error :(" Implicit conversion loses integer precision: 'NSUInteger' (aka 'unsigned long') to 'u_int32_t' (aka 'unsigned int')"