Xcode Can't remove UIBarbuttonItem without getting error - ios

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.

Related

App crashes when I add Charts UIView as IBOutlet to ViewController

I am using Daniel Gindi's Charts library.
I have a ViewController in my app that is a scrollview, and it is supposed to display 4 line charts on different axes (i.e they are in different UIViews), and because the lineCharts themselves are quite big, I put them in a ScrollView to ensure that the graphs can be seen clearly.
Before connecting the UIView to the ViewController, the app works fine. I could scroll the page as expected, and also the LineChartView looks fine, it just displays "No Data to Show"
However, I realised my app crashes after trying to debug my failing ViewController. I realised I could not even add the IBOutlet for the LineChartViews into my ViewController. I tried it with one and it gives an NSUnknownKeyException, and the problematic part of the code is the IBOutlet. I have made sure all my connections are clean, in fact I rebuilt the storyboard to make sure everything was fine and it still crashes when I establish an IBOutlet.
There isn't much code involved as it just involves establishing an IBOutlet with the relevant ViewController. I saw in another post that adding chart.translatesAutoresizingMaskIntoConstraints = false might help and it did not.
The error is:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key chiller1Trend.'
You cannot use chiller1trend as anIBOutlet and as a Cocoa binding key. You need to do one thing or the other, not both, because if you use bindings you don’t need that outlet. Thus, either remove that outlet from the view controller class code or select the UIControl to which chiller1trend is bound in the bindings inspector in your storyboard or xib file and delete that Cocoa binding. Do not forget to check if the module of your controller is also well set.

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.

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

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.

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