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 Music Library and Playlist Models Using a Playlist Instance

Andrei K
Andrei K
7,601 Points

This class is not key value coding-compliant for the key playlistImageView0

I'm getting this error:

Algorhythm[5154:897155] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fcfe9c90500> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key playlistImageView0.'

I've usually found that the issue is somewhere in outlets, could anyone give me a run-down of what outlets should exist for buttonPressLabel, aButton, and playlistImageView0? I think that may be the root of the issue.

1 Answer

Tommy Choe
Tommy Choe
38,156 Points

Hey Andrei, Your view controller may may have the wrong class in your xib. Look through this page and see if the most voted solution works for you. http://stackoverflow.com/questions/3088059/what-does-this-mean-nsunknownkeyexception-reason-this-class-is-not-key

Let me know if it worked for you.

Andrei K
Andrei K
7,601 Points

I took a look but I have no such file (to my knowledge). All I have are AppDelegate.swift, PlaylistMasterViewController.swift, PlaylistDetailViewController.swift, Main.storyboard, MusicLibrary.swift, Playlist.swift, LaunchScreen.storyboard, and Info.plist. There are a few other miscellaneous files but no .xib files.

Tommy Choe
Tommy Choe
38,156 Points

Hmm.. ok so I'm thinking it could be that you have an orphan outlet in your storyboard file. This could be the case if you deleted the playlistImageView0 property but not the connection referencing it.

If that's the case try this: Go to the storyboard file and click on the imageview itself. Then open the connections inspector (cmd + 6) and check if the connections are being made appropriately. If you still have the playlistImageView0 property, make sure that that's the only one being referenced. If you've deleted the property, make sure there are no connections being made. Close out any connections by pressing the small 'x'.

If you're still getting the error, try posting up your code so that we can see if there's anything wrong with your code.