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.
My app is crashing on every screen at app delegate where ever I have used label and textfields. When the tags are removed app is working fine but is crashing again when connected to swift file again.
If you have this type of error
STEP 1:Go XIB or if use STORYBOARD go STORYBOARD
STEP 2:Click View Controller
STEP 3:Again Give connection properly(Fill the circle)
STEP 4:Also check whether it is for button action or outlet property
Very Important: Right Click the File's Owner(Yellow Color) and Click on the "Connection Inspector" (upper right arrow), to see all outlets at once. Look for !s which indicates a missing outlet.Remove that. Now it works.
I am running XCode 7.1 and running on device(iOS 9) - (not simulator). I am loading up a nib file by name as such:
MyDetailsViewController *myDetailsVC = [MyDetailsViewController initWithNibNamed:#"MyDetails" withNotificationCenter:notificationCenter];
this is simply just a class method that i have set up that loads up the xib via the mainBundle. The xib file is just a UIView with a tableview inside of it everything seems to be hooked up properly. However, when loading the nib(viewWillAppear, viewDidLoad etc hasn't executed yet) from the bundle I get the error:
NSUnknownKeyException, reason: '[MyDetailsViewController setValue:forUndefinedKey:]:This class is not
key value coding-compliant for the key tableView'
I know that I am not getting back some generic view controller because it spells out very clearly what view controller we are talking about. The File Owner seems to be hooked up properly and its Custom Class is set to MyDetailsViewController. Even when I hover over the IBOutlet 'circle' in code the tableview highlights as well as when i hover over the menu when checking the outlets.
Something that may be totally unrelated is the internal error message in the xib file, it may or may not be related to my problem and i've never seen it before. The beginning of the log file that you get from that error is:
Can anyone help me determine what is going on here? I would appreciate it.
here are a few more screenshots:
Before init you should call alloc first:
// MyDetailsViewController *myDetailsVC = [MyDetailsViewController initWithNibNamed:#"MyDetails" withNotificationCenter:notificationCenter];
MyDetailsViewController *myDetailsVC = [[MyDetailsViewController alloc] initWithNibNamed:#"MyDetails" withNotificationCenter:notificationCenter];
This warning happens in Xcode 6.1. Anyone have ideas what does this warning mean and what will happen with it? Many thanks!
Below is a screenshot with the warnings opened in source code"
How to find which constraint causes the warning? Xcode does not tell you which constraint is the problem.
This warning can be annoying and happens as of Xcode 6.1.1. The main problem is that you can not easily find the referenced constraint by clicking on the warning. I guess this is a bug and will get fixed sooner or later.
However, in the meantime you can use this little workaround:
Step 1: Detect annoying warning ๐ฑ
Step 2: Right/Ctrl-Click on warning, select Reveal in Log ๐จ
Step 3: Admire the beauty of the following log snippet:
... snip ...
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:Dlb-cb-nWC: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:6Ze-mO-v5N: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:9av-xw-u1o: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:RPt-Uf-vaZ: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:Rnc-4M-7jV: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:epJ-D9-KEF: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:4HC-Gu-01w: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
... snip ...
Hmmm... What's this...?
Step 4: Let's toss that into the project search bar... ๐
๐ฎ Yep, you guessed right. Click it.
Step 5: ๐ OMG! Enjoy a few extra minutes of productivity until Apple fixes this annoying bug. ๐
For 2016...
If you can't get it with 'Reveal in Log', show the Report Navigator. (That is the rightmost tab on the leftmost column.) Delve into the build results there. That will show the build log, including the constraint ID. courtesy buildsucceeded
Note that for Xcode of 5/2016, annoyingly you have to quit and restart Xcode to clear this warning in some cases.
Note that confusingly, the same error can be caused by an unrelated problem (this appears to be an Apple bug or poor use of error language): if you have IBInspectable items, and happen to rename them in your Swift files. Xcode does not delete the old-name UserDefinedRuntimeAttributes for you. Simply click to "Identity Inspector" (item 3 on right panel) and delete the dud items.
For 2017...
Yet another common, and indeed simpler, cause of the problem. If you happened to un-Install an item: As of writing, very simply Xcode does not know to automatically also uninstall any constraints which lead to that item. Quite simply, look at any un-Installed items, and for all of its constraints, just mark them un-Installed. (Or simply, perhaps just temporarily delete the un-Installed item altogether, to see if that's the problem.)
This message is triggered when you have deactivated a view in your storyboard, but didn't deactivate the constraints based on that view.
For example, you deactivated a button, but you still have some constraints linked to that button. It may be an intrinsic constraint like height or width, or a relative constraint like the distance from another view.
You have to turn off each of the constraints referencing the view, and you have to do it manually. Xcode is being overconservative here and won't do it for you.
This solution works for me.
Because I copied several items from the project I developed in Xcode 5 into Xcode 6, and the storyboard in Xcode 6 supports multiple layouts, for every constraint, I need to install it in the current configuration.
For example, I am using "Compact Width | Regular Height", for the constraint I need to set like below:
After I checked and set all the hundreds of constraints in my projects, clean and build, the warnings finally disappear.
Just wanted to add my case how this Error happened for me: In my case, I wanted to delete a Textfield with "Cmd+Backspace". I did this directly in the Scene-Builder Tree-View:
You can see that the snooze Field is grayed out.
So that was easily discovered for me. You can than simply really delete
the Field by selecting:
Edit-Delete from the Menu
Surprisingly - this really deletes the field (including the constraints).
Maybe this helps someone to easily find the cause of this annoying Warning...
Expanded Explanation
Nothing wrong with the other answers. I just wanted to draw attention to the wording in the original warning and to identify a couple of use-cases where this can show up in one's workflow.
Constraint referencing items turned off in current configuration.
Meaning that some item (usually a control or custom view that is normally visible) referenced in one or more constraints is turned off (disabled or has the checkbox "installed" unchecked). If for example you decide that you want to move a control or view in your storyboard outside of the main view (or you may see sometimes when doing something interesting in size classes) then you may see this warning if the control has constraints attached to it.
Along with the recommended solution:
Turn off this constraint in the current configuration.
Two Approaches to Fix
Document Outline
Visually you can open the Document Outline in your storyboard and look for the grayed out Constraints that reference your control/view sitting outside of the main view (widen the outline, click the constraint, and view the attributes inspector, mouse down to review fast). Then remove the constraint from this context (size class). For example, in my case I am just holding the control until I decide later where to present it, so I chose to delete completely the offending constraint until later. But in a size class I would just uninstall the constraint from the current context using the installed checkbox in the attributes inspector.
Log Navigator/Find Tool
One can also continue to use the Log Navigator to find the problem control via the unique identifier given to each object on the storyboard. In the log it would be just before the yellow highlighted text and typically takes the form as seen in my example above: jvj-mY-DHf
Using the identifier one can then use the find tool in Xcode to locate and delete (completely) or uninstall (for the current context) the offending constraint.
If you're fond of Xml and its simplicity you can also just open up the Storyboard as Source Code and find the offending unique identifier and delete the appropriate block of xml.
One of the reasons this could happen is because you selected a size class not compatible with your constraints (wAny hAny is a common case). In such case, just select a different size class in Interface Builder and you are done.
For me, it happens if I set an object a new contraint to object (not view) with "Constraint to margins" option not ticked. Problem solved with tick the option (which is default).
What worked for me (and I have no idea why) is to turn "Use Trait Variations" off, then perform a clean, then turn them back on. The next build had no warnings.
To turn off "Use Trait Variations" simply select your storyboard in the Project Navigator and then select File Inspector.
Then just deselect "Use Trait Variations", perform clean by pressing Shift-CMD K, and then turn trait variations back on if you want to use them.
I thought it was a persisting constraint due to the other answer, however it was due to an 'outlet' I still had for an item I deleted before. What to do is:
Select your ViewController
Click on the 'outlet' icon on the top right
Look through your outlets and carefully delete any that you don't need
Worst case scenario you delete all your outlets and just hook them up again. Case solved!
As mentioned and well guided in #BadCat's answer,
I followed down the steps and just one more step I dared to take!
Steps to carry after last step of BadCats answer:
Step 1:
I selected the constraint in the Interface Builder and then keeping that on mind what it is it for and then deleted it.
Step 2
Build the XCode Project and it will show you may be the number of Warnings are increased. That's because you have deleted a constraint that it needs to compile well. So, go to 3rd Step!
Step 3
Re-add the constraint which you kept in mind(the one you deleted).
And then re-build it again!
For Me the warnings went away just by doing this!
I guess this will work out for some people!
Cause:
As I could understand the problem which caused to this warning was, I had a Label connected to an IBOutlet, but its name was starting with a capital letter. So I renamed it with a simple letter in the ViewController and came to change it in the IB. I removed past IBOutlet and went to connect it to the newly renamed property name and connected. Then I noticed there is a new warning come up.
First I tried the following answer too in this thread, but it didn't help!
Cheers!
My case is choose label, then click control + X, it will be disable, but I don't do any thing with it. When I build, it will show warning.
Solution: remove label or remove chosen control + X for label.
I delete all those UI elements including their constraints, and add them all again, those warnings just disappear. Anyway this is a worst but useful way to solve this.
I had the problem on a stack view. Deleting the constraints and re-adding them did not help. Cleaning and rebuilding did not help.
For me, the solution was to create a completely new stack view object.
Then move all elements from the old stack view into the new stack view.
Deleting the old stack view fixed the problem.
For me, the problem was a constraint "Installed" for the "wR" view class that now needed to be "Installed" for all view classes:
Checking the general "Installed" box and unchecking the "Installed" box for "wR" made the constraint work properly:
But the warning still did not clear. It turns out you have to delete the "wR" option altogether by hitting the "X" to the left of it to make the warning go away:
{Xcode 4.2, deployment target iOS4.3, not storyboard, using ARC}
I started with a tabbed application template & chose the universal platform, which nicely gives me view controller classes & NIB files for an iPhone (ClassName_iPhone.xib) & an iPad (ClassName_iPad.xib) for 2 tabs, with an if statement in the AppDelegate to determine which to run - exactly how I wanted it set up.
I wanted to add a 3rd & 4th tabs, so starting with the 3rd tab (doing 1 at a time) I created a new UIViewController subclass. As it doesn't give the option to create both NIBs at once, I selected "Targeted for iPad", & had intended to create the iPhone NIB manually. I added a "_iPad" suffix to the created NIB file, then I created a user interface view NIB file to which I added the "_iPhone" suffix. I then set up the code for the new view controller in the AppDelegate implementation file to include the 3rd view controller & tab, & I used the other view controller classes as a guide to set up the new class's code.
For the 3rd _iPhone NIB, I dragged a view object from the objects library onto the canvas, & set it up as per the other 2 _iPhone NIBs. But when I went to connect the outlets, there is no view outlet in the referencing outlets of the connections panel to connect with, which I thought there should be. At this point I suspected something was wrong.
I tried running it in the simulator, in iPad mode it works fine (all 3 tabs are clickable). But in iPhone mode clicking the 3rd tab crashes it with a "SIGABRT" on thread 1. It's obvious what I did didn't work. I don't see anything in the output window that gives me any clues.
Being a newbie to obj-c, so not being too sure of the problem, I would have thought that I either:
have used the wrong user interface template (view)
should have used a view controller object from the object library
(not a view)
or that I should have declared some outlets in my view controller
class files.
But if I should have done either of the latter 2, then my question would be why does the iPad NIB work then, when it clearly has a view object in the NIB & no outlets declared in the class files (same with the other 2 view controllers for both devices)?
Does the UITabView class somehow have outlets pre-declared within it for the first 2 tabs? But that still doesn't explain why the _iPad NIB works.
As usual, any help & advice much appreciated, & if there's a link to an explanation somewhere that I've missed, please show me, because I'm happy to do the research.
If what I've done wrong here is not determinable, then I guess ultimately what I'm asking is a clue to how best to create the second NIB file for iPhone to mesh with the class created with iPad NIB.
Sorry to answer my own question but with further searching I found this answer that was the solution, although not quite the whole story. So I thought to put what I did in an asnwer so others can refer to it.
As Piotr Czapla explains in the linked answer, for some reason Xcode doesn't populate the connectionRecords data, as you can see by my first red arrow. Having a look at the view controller that works (where second red arrow is), that's what the data should look like. So the answer is to cut the data & paste it into the NIB file, or type it. You can do this in Xcode by right-clicking the NIB file in the project navigatior & then Open As > Source Code, which is what you see in my screenshots.
The bit I want to add to Piotr Czapla's explanation though is the destination reference pointed to by the second red arrow might not be correct for the NIB file you're pasting into (mine wasn't) & Xcode might not let you go back into IB mode. If so, you need to get the correct reference from the IBUIView class within your NIB file, as pointed to by the third red arrow. Once I copied that reference to my destination reference ref=, as shown by the fourth red arrow, all was ok & the problem was solved. I could then go back into IB mode (right click, Open As > Interface Builder - iOS) & the view works in the simulator.