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
William Howze
4,168 Pointsfatal error: unexpectedly found nil while unwrapping an Optional value (lldb)
I keep getting this error message when trying to run the application.
Michael Hulet
47,913 PointsCould you post the code of the function where it crashes?
William Howze
4,168 PointsIt fails here "Thread 1:EXC_BAD_INSTRUCTION (code=EXC_1386_INVOP, subcode=0x0)"
icon = UIImage(named: iconName)
1 Answer
Steve Hunter
57,712 PointsHi William,
I think you have capitalised the JSON field name. Change the line:
let iconName = playlistDictionary["Icon"] as! String!
to
let iconName = playlistDictionary["icon"] as! String! // lower case icon
Give that a try - let me know if it works, or not.
Steve.
William Howze
4,168 PointsThat was it. Problem fixed. Not speaking sarcastically, but this is why I love this stuff.
Thanks Steve!!
Steve Hunter
57,712 PointsGlad you got it fixed! :-)
Steve.
William Howze
4,168 PointsWilliam Howze
4,168 PointsScreenShot