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
Siver Salih
2,795 PointsEXC_BAD_ACCESS (code=1, address=0x6568544c)
Hi, Can someone help me with this error. I'm stuck at "Getting to Know Arrays" in iOS Development video.
When I run the simulator after clicking on Predict button, I'm getting EXC_BAD_ACCESS (code=1, address=0x6568544c) at PredictionArray.
Here how I have PredictionArray, which I followed the video. PreictionArray = [PredictionArray initWithObjects:@"It is certain",@"It is decidedly so",@"The starts are not aligned",@"My reply is no",@"It is doubtful",@"Better not tell you now",@"Concentrate and ask again",@"Unable to answer now", nil];
Note the code compiles fine, but in run-time it fails when I click on the Predict button. If I could guess, I think its memory leak or its trying to access or allocate memory which the program doesn't have privilege access.
Siver Salih
2,795 PointsHi Amit, Thanks for replying and sorry for the typo. Here how I have declared PredictionArray.
NSArray *PredictionArray = [NSArray alloc]; PredictionArray = [PredictionArray initWithObjects:@"It is certain",@"It is decidedly so","@The starts are not aligned","@My reply is no","@It is doubtful","@Better not tell you now",@"Concentrate and ask again",@"Unable to answer now", nil];
I also tried the other version
NSArray *PredictionArray = [[NSArray alloc] initWithObjects:@"It is certain",@"It is decidedly so","@The starts are not aligned","@My reply is no","@It is doubtful","@Better not tell you now",@"Concentrate and ask again",@"Unable to answer now", nil];
Syntax-wise, the code compiles ok. I know, because iOS Simulator opens up with right UI. However after I press the Predict button, I get run-time error EXC_BAD_ACCESS (code=1, address=0x6568544c).
Also I should mention, I'm running Xcode environment all via VMWare Workstation. That is I'm on Window, and I've created Mac OS X virtual machine and setup Xcode environment to follow up with the videos. Tell me if this environment setup is ok to go along with the course.
2 Answers
Amit Bijlani
Treehouse Guest TeacherRunning Mac on VMWare is not recommended so I don't know what sort of impact it will have on your development efforts. Although the problem you are having does not seem related to the environment. Your array code looks fine. Since you are having an issue when you click on the button it could be related to IBAction. You might have to check your connections to ensure that don't have a ghost IBOutlet or IBAction.
Siver Salih
2,795 PointsThanks Amit for your help. I still couldn't pass the error and tried your suggestion. I have the Connection Inspector exactly as you have in the shown image. For now I just downloaded your project and I was able to compile and run your code on my setup. So I'll continue with the video and the project. Hopefully I will understand this error later when I become more expert.
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherCan you paste your code exactly how you have it because I already see errors in the code you have written above. You don't have an
allocand you have 2 spellings of youPredictionArray.