0

It is not a duplicate because NSUnknownKeyException can come from a lot of different reason, and the link between refreshing and NSUnknownKeyException is not addressed in the "duplicate" of my question.

I have a small app, it worked perfectly until I have enabled the refreshing option and created an action from the refresh from the storyboard to my viewController

@IBAction func refresh(_ sender: UIRefreshControl) {
    searchForTweets()
}

And I get this error in the console

> One of the two will be used. Which one is undefined. 2017-08-11
> 23:48:45.816 Smashtag[21842:1873832] *** Terminating app due to
> uncaught exception 'NSUnknownKeyException', reason:
> '[<Smashtag.TweetTableViewController 0x7f854f50bee0>
> setValue:forUndefinedKey:]: this class is not key value
> coding-compliant for the key refresh.'
> *** First throw call stack:

I receive a thread 1: signal SIGABRT on this line

class AppDelegate: UIResponder, UIApplicationDelegate {

weird because I was expecting everything to be fine...

2095377
  • 47
  • 2
  • 14
  • Could you please be more specific in your question please, can't understand where your problem may come from. – 2095377 Aug 11 '17 at 21:21

1 Answers1

0

Ok so for everyone getting this error,

It may come from the fact that you thought you deleted an outlet or action but you didn't.

In my case, I've linked the refresh to my viewController class, and I made a mistake, instead of choosing action I chose outlet, so I made a cmd+z to go back to the previous situation, then I created my action properly, but in fact the outlet was not deleted.

So you have to select your storyboard, go on the arrow on the right panel, "connection inspector" and delete the action or outlet you don't need.

2095377
  • 47
  • 2
  • 14