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 trialMarilyn Wagner
6,666 PointsCan't see "Button Pressed" on console
I followed all instructions in video and confirmed that the button was connected to the IBAction (i.e when I hovered, the button became highlighted). Then in my ViewController.m I added the NSLog statement. When I ran the app, the iOS Simulator was totally black and stayed black. Not until I hit "Stop" to stop running the app did I see on the Simulator an icon in the upper left section labeled "CrystalBall" with a Safari icon at bottom. When I clicked on the "CrystalBall" icon I saw the correct page: "It is decidedly so" with the blue "Predict" button. At this point the app had stopped running. Consequently, nothing ever appeared in the console. Any thoughts on what I need to do? Thank you!!!!
Marilyn Wagner
6,666 PointsThank you for your help. Here is my code:
//
// MWViewController.h
// CrystalBall
//
// Created by Marilyn Wagner on 5/2/14.
// Copyright (c) 2014 MarilynWagner. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MWViewController : UIViewController
- (IBAction)buttonPressed;
@end
//
// MWViewController.m
// CrystalBall
//
// Created by Marilyn Wagner on 5/2/14.
// Copyright (c) 2014 MarilynWagner. All rights reserved.
//
#import "MWViewController.h"
@interface MWViewController ()
@end
@implementation MWViewController
- (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 {
NSLog(@"Button Pressed");
}
@end
2 Answers
Michael Jones
Python Development Techdegree Graduate 38,554 PointsHi Marilyn,
Here's what I have in my 'buttonPressed' method. Hope this helps -
- (IBAction)buttonPressed {
self.predictionLabel.text = [self.predictions objectAtIndex:3];
NSLog(@"Button Pressed");
}
Marilyn Wagner
6,666 Pointsthank you!
Kai Aldag
Courses Plus Student 13,560 PointsKai Aldag
Courses Plus Student 13,560 Pointscan i see your code.