1

In Xcode, when I run my application, I am getting the error: "this class is not key value coding-compliant for the key adBanner." If I take away references in the code to the iAd banner, it shows for the next outlet (UIButton), and the next (UITextField). I wanted to change the name of my project/app and so I did, which started causing this error. So I just said screw it and made a new project and named it what I wanted and copied over files, storyboard, etc. No error, until I compile and still get that error. I checked the connection inspector and there are no "!"s. I am not sure what is going wrong here.I deleted the connection and re-added the ADBanner outlet, only to get the same error.

My project was working fine before I changed the name, so I know the code is fine. I not sure where the outlet error is coming from though.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ethan Schatzline
  • 139
  • 1
  • 13
  • Just in case, try cleaning out the caches, including all existing copies of the app on the simulator and/or device. Old stuff often gets left lying around when you make a change like this, so the change doesn't "take". See my explanation http://stackoverflow.com/a/6247073/341994 Might not solve it but it's an important first step when you're mystified like this. – matt Dec 04 '15 at 20:47
  • @matt Just checked out your post and went through everything you said to do, still no luck. :/ I am so confused on what could be causing this, because unlike other posts like this, my connection inspector shows no problems. :/ – Ethan Schatzline Dec 04 '15 at 20:58
  • Go through this one: http://stackoverflow.com/questions/3088059/what-does-this-mean-nsunknownkeyexception-reason-this-class-is-not-key – rmaddy Dec 04 '15 at 21:08
  • @rmaddy Fixed. It wasn't that the viewcontrollers were set to the wrong class, since I copied over the storyboard file, it was that the module was set to the previous name of the project. Changed the module name and it fixed the problem. Thanks! – Ethan Schatzline Dec 04 '15 at 21:11

1 Answers1

1

The problem in this particular situation was not that the connection inspector had problems with outlets, it was that I had copied over files from a previous project to start a new project with a new name. The problem all along was that under each view controller in the storyboard, where I had set the class for each view controller, the module for that class was still under the name of the old project. Switching the module for each view controller class fixed the problem.

https://stackoverflow.com/a/3088280/5461563 pointed out to check the class was set correctly, which they were, but while checking that I noticed the modules were wrong. Thanks @rmaddy also for referencing this solution.

Community
  • 1
  • 1
Ethan Schatzline
  • 139
  • 1
  • 13