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

Fatal error: Unexpectedly found nil while unwrapping an Optional value

In my PlaylistMasterViewController.swift file, on the line of code:

playlistImageView0.image = playlist.icon

I have the error:

Thread 1: EXC_BAD_INSTRUCTION (code=EXC_1386_INVOP, subcode=0x0)

In my console output, I have the following lines:

Unknown class Playlist in Interface Builder file.

CUICatalog: Invalid asset name supplied:

Could not load the "" image referenced from a nib in the bundle with identifier "com.jdpruitt.Algo-Rhythm"

fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)

1 Answer

Hiya,

What is in your JSON for the zero playlistImageView? It looks as though it has pulled back "" or the image isn't available. Your asset should have coffee.pdf in there for that icon.

Steve.

Hi Steve,

Ah, thank you ... you helped me realize that I had a broken IBOutlet at:

@IBOutlet weak var playlistImageView0: UIImageView!

Deleted and re-connected it. (Hope I'm using the correct terminology!)

Thanks so much for your help!

JD