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

Just started on the Build a Simple iPhone App tutorial and something is wrong

I'm following along plugging in info as directed, but it doesn't work in the simulator.

Here is my Xcode smart editor info:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
- (IBAction)buttonPressed:(id)sender;
@property (strong, nonatomic) IBOutlet UILabel *predictionLabel;

@end

Here is my implementation info:


#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)buttonPressed:(id)sender {
    self.predictionLabel.text = @"Definitely yes";
}
@end

 With that, I get this error when I run the simulator:


#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

2 Answers

Here is the error message: @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass ([AppDelegate class]));

FYI if you need it: I just downloaded Xcode (4.6.2) and the iOS Simulator (6.0). My mac is running OS 10.8.3 Also, Xcode specifies iPhone 6.1 Simulator, but I didn't see a way to upgrade mine from 6.0.

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

Unfortunately, the code you provided is not an error message, it simply means that the app is halting execution on that line of code within the main.m file. I'm not sure what the problem could be without knowing the error. You have 2 options: zip up your project and provide a link here so I can download it to see what is going on or you just create a new project.

Thanks Amit for your help. I trashed the project and started over. It worked. I must have missed something and going over it a second time helped with my understanding the concepts better. However, I'm having trouble with the Array Challenge. I passed the first part, but can't figure out the second.

Here is my code: NSArray *myArray = [[NSArray alloc] initWithObjects:@"Apple",@"Orange",@"Banana",@"Plum", nil]; self.myArray.text = [myArray objectAtIndex:0];

It's the second line I've got wrong. I've tried a number of things but can't figure it out.

Same issue.

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

In your last line there is no need to assign it to anything. You simply need to demonstrate that you can know how to access an element within an array.

On another note. In a code challenge you will almost never use self because it is used only of you define a property.

Thanks!!!

Duane I just passed it. Hint: only write code in brackets! Damn, spent 2 hours last night writing every possible avenue.

I hear you. I'm getting the feeling you gotta have a thing for pain and frustration to be any kind of programmer.