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

Fatal Error: unexpectedly found nil while unwrapping an Optional value

In the playlist.swift file in the block of code artists += playlistDictionary[artists] as! [String] and in the master view controller in the let playlist = Playlist(index: 0)

Please help!

3 Answers

Hi.

Any errors in Xcode? If you write the line in Xcode an error could popup there where you write the "BANG" operator:

as! -> as ![String]

Could only be a typo:)?

No it is not that, I checked though, but is there anything else?

OK. My bad. Sry for the wrong tip :)

Provide the link for this challange ?

And if you are having problems on any challanges ask a question out from the challange so the link is automaticly added.

From creating a playlist instance

Ok. I'll check:) BrB

Can't find it... A link would go a long way now :)

if you are using Xcode 6.4 and swift 1...something do not use ? when you declare your properties on the struct Playlist. On the other hand, when you declare an instance of UIImage(name: iconName) unwrapped it with !. like this: let largeIconName = playlistDictionary["largeIcon"] as! String largeIcon = UIImage(named: largeIconName)!

xcode will complain if you forget to it!. I hope this help. I was in the same boat but i start digging to find what was causing the error and that was it.