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 Build a Playlist Browser with Swift Building the Master and Detail Views Displaying Playlist Information

John Judge
John Judge
3,527 Points

EXC_BAD_INSTRUCTION when clicking button in simulation.

^ This pops up after I've pressed the button and the app crashes. Followed by (code= EXC+i386_INVOP, subcode=0x0)

The line it appears on is //playlistCoverImage.image = playlist!.largeIcon

When I look at the var in the Playlist.swift file it highlights the name of the variable.

Halp?

5 Answers

Maybe there is a wrong constrain with the storyboard file. Or you can just try to clean the build by command + k + shift. Are you sure that all files are in the right place? Seems like you've forgotten to add the largeIcon image to your project. If all doesn't work just download the project files from the latest tutorial and compare them to yours.

I'm using xcode 7.1.1 and the command+shift+k solution worked for me. I was getting a BAD_ACCESS error in my PlaylistMasterViewController. Just wanted to share this in case someone else has the same issue. I'm guess this error has been updated since xcode 6.x.

John Judge
John Judge
3,527 Points

It's weird. I've followed all of the instructions, and definitely added the image to the project - the smaller icon shows up and in the assets folder all of the images show up there. I'm not sure where the disconnect here is, but the clean build did not work. I've downloaded the teacher copy and checked everything and it all looks the same. I'll just move forward, but it would be really nice to be able to learn from whatever mistake I've made. Thanks for your help!

No problem. I understand what you, sometimes these also happen to me and than I just go ahead and download the teacher files and paste them in and mostly it works than.

Waseef Akhtar
seal-mask
.a{fill-rule:evenodd;}techdegree
Waseef Akhtar
Full Stack JavaScript Techdegree Student 2,802 Points

I have the same error and I don't know what seems to be the issue. My code seems to go into the if playlist != nil, but that's it.

When I press the "Press Me" button in the simulator, I get a "fatal error: unexpectedly found nil while unwrapping an Optional value" error, and the segue doesn't transition to the Detail View Controller.

Please help.

Ga-eun Kim
Ga-eun Kim
2,558 Points

I even copy and pasted the teacher copy, but it's still not working, and the same error (EXC_BAD_INSTRUCTION) shows up. Is there something wrong with my story board settings??

Eduardo Pinheiro
Eduardo Pinheiro
4,649 Points

Check to see if you've named your outlets correctly. I had named one of them palylistArtist0 instead of playlistArtist0 and I got the same fatal error.