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 trialJoannie Huang
6,195 PointsWhen I execute the code, it will have a thread regarding the memory thrown.
I have double-check the code, its without any syntax error and is same as video. And when execute the code, it will have a on the ViewDidLoad function.
#import "THViewController.h"
#import "THCrystallBall.h"
@interface THViewController ()
@end
@implementation THViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.crstalBall = [[THCrystallBall alloc] init];
// 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 {
self.predictionLabel.text = [self.crstalBall randomPrediction];
}
@end
4 Answers
Joshua O'Connor
Courses Plus Student 3,207 PointsDoes your project come up with a green line anywhere saying "Thread 1:Breakpoint 1.1"? If so you will need to use the keyboard shortcut CMD(?)+7 to bring up all these breakpoints. Take note of the code that has been selected as a breakpoint (possibly write it down first) and then delete the highlighted code. Then re-input the code that has been deleted (do not copy and paste) Save your code and test it. Hopefully this should work.
Joshua O'Connor
Courses Plus Student 3,207 PointsI know you said it is not a syntax error but I would just like to check, did you spell "crstalBall" like that in your code on purpose instead of "crystalBall" and "THCrystallBall" instead of "THCrystalBall"?
Joannie Huang
6,195 PointsHi Joshua, yes, I was define the cystalBall and THCrystallBall in my code. I think the compiler has passed the code, but when execute it, then would show the exception on the viewDidLoad function. Not sure it's regarding the memory allocate issue?
Joannie Huang
6,195 PointsHi Joshua, Thanks a lot. I followed your steps and it works now! Just curious that the breakpoint was occurring on the "}" and the comment which is from the project sample file.... Why is the cause reason of this, do you know?
Joshua O'Connor
Courses Plus Student 3,207 PointsYou're welcome, I'm glad it worked for you. Sorry I don't have a clue why this happened.