17

I removed manually from my Xcode project Alamofire POD and since this time, I have errors in some UIViewControllers on any UIButton IBOutlet added.

I have the following error:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key btListOrdo

I tried to create a new UIViewController and link it to my StoryBoard but I have the same error....

I'm adding the following IBOutlet

@IBOutlet weak var btListOrdo: UIButton!

Notice that those links worked properly before the POD removal, I may have removed something mandatory but I'm not able to find it.

here is the screenshot of the referencing outlets of my button:

enter image description here

I also tried to clean the project, cleaned the Build Folder, deleted Derived Data, Reset Content and Settings of the simulator but same result...

tiamat
  • 879
  • 2
  • 12
  • 35
  • 1
    Have you searched with ⇧⌘F and keyword `btListOrdo` in the project? – vadian Jul 11 '16 at 13:53
  • it exist in the Storyboard "Dashboard View Controller: Outlet = "btListOrdo"" and also in my viewController " @IBOutlet weak var btListOrdo: UIButton!" – tiamat Jul 11 '16 at 14:24
  • Look also in Interface Builder if there is a dead connection. – vadian Jul 11 '16 at 14:25
  • Try to remove the referencing and recreate it. – Larme Jul 11 '16 at 14:39
  • I tried to remove it and recreate it, even with a different name, I have the same error.... Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key buttonOrdo. – tiamat Jul 11 '16 at 14:48
  • I also tried to clean the project, cleaned the Build Folder, deleted Derived Data, Reset Content and Settings of the simulator but same result... – tiamat Jul 11 '16 at 14:50
  • Nobody can help me? May be I can recreate a new project based on my sources? – tiamat Jul 11 '16 at 17:30
  • I Finally solved my problem (or at least found a workaround) by deleting the ViewController and created a new one.... – tiamat Jul 12 '16 at 11:50
  • I have the exact same problem. The only way I've been able to fix the problem is by removing the ViewController, then recreating it entirely. – Gary Kenyon Jul 18 '16 at 07:26
  • You're right... It seems to be the only solution... – tiamat Jul 18 '16 at 09:27
  • I just removed all of the reference outlets from the objects AND ALSO the file's owner in the .xib file and connect them again. I had copied my view from another xib file. – Marjan Basiri Nov 28 '21 at 06:15

7 Answers7

48

Okay I just faced the same issue and it was due to having multiple targets. I couldn't figure out why it would run perfectly fine in some instances, yet not others. The issue is actually with the Module definition on the view controller, I'm guessing that this may explain why when you completely recreate the controller the issue seems magically fixed. On mine I had the Module set to one of my targets, so when I ran a second target it wasn't associated. If you have multiple targets make sure you empty the Module box on the VC that crashes (on your storyboard) and tick Inherit Module From Target.

Hope this helps

enter image description here

Elliott D'Alvarez
  • 1,217
  • 16
  • 30
  • 1
    It worked for me too, but remember that you have to also check all xibs not only storyboards :) – Marcin Żmigrodzki Jun 11 '21 at 07:35
  • 2
    After 4 hours of hard work and multiple hits & tries, this checkbox solved my issue. This happened because I copied a View controller from another project whose target was pointing to the original View controller and not my current project. – Bharat Lalwani Jun 19 '21 at 19:42
10

if you tick checkbox inhertite done should check key in log alert or look in source and then delete in alert ui

in same picture

try check.

if you find alrt same picture delete it.

enter image description here

Papon Smc
  • 576
  • 4
  • 11
  • This answer help me. I put a typo for my slider bar's name. And I change the outlet name, though the connection name in the `connection inspector` is not changed. Reconnect it in IB fix the issue. – Zhou Haibo Nov 11 '20 at 03:00
7

Check that your class is the same that you use in storyboard

enter image description here

Benkerroum Mohamed
  • 1,867
  • 3
  • 13
  • 19
Sponxie
  • 71
  • 1
  • 2
0

Just to throw in my 2c, the way I fixed this error was by checking my reference outlets and making sure I didn't have any that were just floating, not connected to anything. I think the swift compiler was getting angry at me for that.

Jon F
  • 11
  • 1
  • 1
    Hi Jon! I just wanted to let you know that this would work better as a comment on the original post rather than an answer. Either that or a more detailed a full response for an answer. – grahamcracker1234 Apr 08 '20 at 23:58
  • 1
    Oh gotcha, I guess people don't like it when you don't know how things work, haha. Thanks for the tip! – Jon F Apr 10 '20 at 16:40
0

I had the same issue while using popular Rswift library to presenting view controller that uses nib.

So I just had to replace

let productCardVC = ProductActionVC(nib: R.nib.productCardVC)

with

let productCardVC = ProductCardVC(nibName: "ProductCardVC", bundle: nil)

and all starts to work perfectly well

0

I remove the button delegate and the problem fixed, the issue was about the button delegate. Check this image

Image

4b0
  • 21,981
  • 30
  • 95
  • 142
0

if you have several targets , check that you selected needed target membership for all your source files. it also could raise such kind of exception.