How to fix error [<UIViewController 0x752f5a0> setValue:forUndefinedKey:] - ios

I'm new to IOS and I'm stuck with an error I added a table view in my storyboard named timelinetable and after some time I deleted that from my storyboard but after that when debugging it shows an error
Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[ setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key
timelineTable.'
but I cant find anything named timelinetable in my project so how can I fix that problem

Go to the xib
click on files owner and click on the show connection inspector button (last one ).
Check out all the connections . The problem is due to you are referencing the outlet which is no more exist.

you connect an outlet and you then remove the controller without removing its outlet.

Related

App Termination when button clicked swift

When I click a button it triggers this function
#IBAction func groupSquare1Tapped(_ sender: Any) {
userDefaults.set(userDefaults.array(forKey: "groupNames")![0], forKey: "currentGroup")
openMessages()
}
I get the error:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Nebula.MessagingViewController 0x15d00ed70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key scroll.'
It used to work fine but I do now know what is changing.
The openMessages() function just changes the view. When I run the userDefaults line out of the function it works fine so it is not that.
How can I fix this?
When you get an NSUnknownKeyException crash, it is often because you have an IBAction defined in your Storyboard (or XIB file) linked to a view controller that does not implement the method named in the IBAction. In this case, it sounds like the action is "scroll".
Try opening the connection inspector in Interface Builder, selecting the button in question, and clicking the X(es) to delete all the IBActions on that button. Then control-drag from the button to your IBAction method to re-establish the link.

iOS TableView error : This class is not key value > coding-compliant for the key tableView

I am getting the following error
'NSUnknownKeyException', reason: '[
setValue:forUndefinedKey:]: this class is not key value
coding-compliant for the key tableView.'
This is the following property I am using to hook to my UITableView in .xib file. I've done this a thousand times, but for some reason it isn't working for me anymore.
#property (nonatomic,weak )IBOutlet UITableView *tableView;
There is no exclamation mark or anything. I don't understand why this error is occurring for me. I must be missing something small here.
I posted a pic below to show proof of no exlamation mark or anything.
Go to Main.Storyboard and command click on the first icon. If you have any outlets or actions with yellow errors redo them.

Getting 'NSUnknownKeyException' after deleting a control and the corresponding outlet in the code

I am writing a very simple app with just one view controller. However I am getting an exception:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
Here is what I did:
added a UIImageView and created an outlet in the code by ctrl-dragging to the assistant editor.
deleted the UIImageView cause I don't need
deleted the outlet property from the code
checked the connection inspector and removed the outlet from the storyboard/InterfaceBuilder.
But I am still getting the exception as listed above, could anyone give me some hints?
Usually you should do a clean of your project, found in the Project menu next to build That way xib files get recreated and often such errors disappear.

Xcode Can't remove UIBarbuttonItem without getting error

So i started with my app with 2 buttons in my calenderview : a day and a week button.
Now i want to just use 1 button and dynamically change the name of it (that part works)
I am using the weekbutton for that. But now I want to remove the day button.
But i cant get it out of my program.
I tried first deleting the link in .xib
Then i delete the button.
Then i remove it from the .h file, and then from .m
It always results in the same error :
* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key dayButton.'
Cant see why i just cant remove the button...
You`ve deleted outlet from code .h/.m file, but somewhere in .xib something is still connected to deleted outlet. Recheck all connections in .xib file to be sure that they have appropriate declaration in .h file.

iOS load from xib not works

I have created a Custom View Controller with XIB file.
In XIB file, I put a tableview and a slider to the view and connect all of them as IBOutlet to the File's Owner.
I check the File's owner class and it is my custom class, so it's ok.
I double checked the view and slider are connected with File's Owner.
But when I try to load my custom viewcontroller, I got this error:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NoteController 0x6bd1da0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key _slider.'
Slider is my IBOutlet (which is connected to the view controller)
I found a lot of same problems on the internet, but all solutions not works for me :(
The load code:
NSArray *xibViews=[[NSBundle mainBundle]loadNibNamed:#"PopoverSetFont" owner:self options:nil];
What should I try?
After 2 hours, and when I ask this question, found a problem. I do not delete a question, I share it, I hope it helps.
So instead of the [[NSBundle mainBundle]... line, use this for load:
PopoverSetFont *popoverView=[[PopoverSetFont alloc]initWithNibName:#"PopoverSetFont" bundle:nil];

Resources