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 Adding Touch Capabilities

app crash

I followed every step just like in the VDO. there are notting wrong until I run the app it crash! and say something like this.

2015-03-03 23:19:11.234 PlaylistApp[7291:982864] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<PlaylistApp.PlaylistMasterViewController 0x7fcf2b73d4f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key showPlaylistDetail.' *** First throw call stack: ( 0 CoreFoundation 0x000000010ce0bf35 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010e94fbb7 objc_exception_throw + 45 2 CoreFoundation 0x000000010ce0bb79 -[NSException raise] + 9 3 Foundation 0x000000010d2237b3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259 4 CoreFoundation 0x000000010cd55e80 -[NSArray makeObjectsPerformSelector:] + 224 5 UIKit 0x000000010d95cc7d -[UINib instantiateWithOwner:options:] + 1506 6 UIKit 0x000000010dbe6572 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181 7 UIKit 0x000000010d696b92 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 65 8 UIKit 0x000000010d695c19 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1075 9 UIKit 0x000000010d694bf2 -[UIApplication workspaceDidEndTransaction:] + 179 10 FrontBoardServices 0x00000001104dc2a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16 11 CoreFoundation 0x000000010cd4153c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12 12 CoreFoundation 0x000000010cd37285 __CFRunLoopDoBlocks + 341 13 CoreFoundation 0x000000010cd37045 __CFRunLoopRun + 2389 14 CoreFoundation 0x000000010cd36486 CFRunLoopRunSpecific + 470 15 UIKit 0x000000010d694669 -[UIApplication _run] + 413 16 UIKit 0x000000010d697420 UIApplicationMain + 1282 17 PlaylistApp 0x000000010cc169fe top_level_code + 78 18 PlaylistApp 0x000000010cc16a3a main + 42 19 libdyld.dylib 0x000000010f129145 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Carlos Pfister
Carlos Pfister
1,970 Points

Same here. I get the exact same crash message. I downloaded the teacher's project to compare my code to his and I can't find the mistake. The app gets hung up on the initial screen that says "Algorythm". Went back and redid everything, can't find where the heck I went wrong.

The build is successful, but then it terminates with the message from Jirayu's post.

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

There is a post in the featured posts in which Pasan says that when he recorded the weather app for Swift he used a beta version of xcode and Swift, please read it, it might answer the problem as he might have recorded in the same version of xcode.

8 Answers

Joshua Michaels
Joshua Michaels
7,306 Points

I had this same error. What solved it for me was checking the Main.storyboard source code file and see if there are any old references to outlets that you deleted.

Right click on the Main.storyboard file and then go to Open As > Source Code.

Looking at your error message, once on the source code screen do a search (command-F) for showPlaylistDetail and see if there are any extra "ghost" outlets or any code errors where that is present in your code.

In my case I had a ghost line from an outlet I had previously deleted. Once I deleted that, everything ran great. Hope that helps.

Thank you so much! This fixed my exact problem :D

Pasan Premaratne
STAFF
Pasan Premaratne
Treehouse Teacher

Jirayu Piriyametha, Caleb Kleveter and Carlos Pfister,

This error occurs when you attempt to provide a string as a key but either the string does not match the key or that key doesn't exist.

In your specific instance, it says the incorrect key is "showPlaylistDetail" which is the segue identifier. Go to interface builder, click on the segue from the master to detail view and in the attributes inspector, make sure that there is a segue identifier provided. If there is one already, make sure it matches the identifier passed in the prepareForSegue method where you check for

swift if segue.identifier == "showPlaylistDetailSegue"

As you can see in my code snippet above, the segue says showPlaylistDetailSegue for the identifier so you probably have "showPlaylistDetailSegue" in one place and "showPlaylistDetail" in the other.

Let me know if that fixes the error.

Oh, and re Caleb's post about Swift and betas...this was recorded on a stable version of Xcode (6.1.1).

Dominic Bryan
Dominic Bryan
14,452 Points

Check your dictionary or if you are calling values from a dictionary sometimes people forget that the key is in a string so make sure to add ""

Apart from this its very hard without seeing the code to help, try downloading the treehouse project and look at it side by side with yours

Sorry couldn't help much Dom

heinz meza
heinz meza
4,788 Points

Hi ALL , my app crashes when I click the playlist icon that goes to the next one..Not sure why but I get this error "Thread 1: signal SIGABRT " Any help please..

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

On the left side of your line of code with the error there will be a fat blue arrow, right click on it and select "Delete break point".

heinz meza
heinz meza
4,788 Points

thanks Caleb, I tried your solution but didn't work...any other idea on how to solve it? Thanks.

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

Sorry, I don't. That is the only context I have seen that error in.

I had this issue as well, for me it had to do with a missing outlet. Which means we deleted the outlet from the code but we did not remove it from the connections. In my case it was a reference to the button that had not been deleted. So the compiler was looking for an outlet for the button that I deleted in order to replace with the gesture.

TL;DR - It possible that you still have a connection sitting around for the button that you deleted.

This is a pretty simple fix, that explains how to remove that connection:

http://www.tech-recipes.com/rx/52021/how-do-i-fix-the-issue-this-class-is-not-key-value-coding-compliant-for-the-key-in-xcode-6/

Piotr Nejman
Piotr Nejman
3,374 Points

Had the same problem and it took me an hour to find the solution - thanks to tips from Joshua Michaels and Pasan Premaratne . While coding I made some errors in spelling - e.g. "Descritpion" -> changed it for "Description" and "ImageCover" -> "CoverImage". I changed it manually in the code but of course it was still in the MainStoryboard source. After a few runs and debugs I found these errors and changed manually in MainStoryboard source code (Open As -> Source Code)

One small remark to what Pasan wrote - in MainStoryBoard source there is showPlaylistDetailSegue as identifier and showPlaylistDetail as action selector and it seems fine. Works for me :)