FinalViewWithSending *newView = [[FinalViewWithSending alloc]initWithNibName:#"FinalViewWithSending" bundle:nil];
newView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:newView animated:YES]; //it crashes here with a thread 1 error, SIGABRT error..
It says:
"Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<FinalViewWithSending 0x1bef70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key loginButton.'"
There is no variable called loginButton so Im not sure why i am getting an error...
Thank you
You are getting the error because there is no property called loginButton. Check your .xib file. There is almost certainly a bad link to a FinalViewWithSending object (likely File's Owner) that specifies loginButton even though it doesn't exist in the class code.
Phillip Mills is correct.
The answer here, for anyone searching, is to edit the storyboard and remove any link to the undefined key specified. You have to edit the storyboard file in an external editor: Right click on the storyboard listing in the hierarchy and then click on "show in finder" or what have you. Open in a text editor, remove said links by searching, save and return to Xcode. No more issue.
This happens when you remove something from the view controller improperly.
Agreeing here - Phillip Mills is correct.
Someone mentioned opening the storyboard up in a text editor - this isn't necessary.
Just click on the storyboard, go to the Connections Inspector. If you've got a problematic outlet, you'll see an exclamation marker next to the outlet. Delete it.
Since this is the first search result for this error, I decided to write an answer for rookies like me.
You are going to get this error if you have Ctrl dragged connections from Buttons which generates code in your ViewController and then you delete just the code without removing the connection.
I got this error because I had accidently added a few buttons as Outlets, when I wanted to add them as Actions. I deleted the code that got generated but the bad connections were still there.
To find and remove them, View->Utilities->Show Connections Inspector
Then click through the different buttons you have and click the x to remove the bad connections.
If you have any localizations, search for bad links in all the storyboards (expand storyboard to find localized storyboards).
This was my situation. I was looking for bad links in one storyboard and they were in the localized one.
You can try the way I used to fix my setValue:forUndefinedKey:]: problem.
I had the same problem:
I had previously made a connection using storyboards from a textfield to a header file. I later decided I wanted to rename my object's connection, unfortunately, I didn't break the connection properly. If this problem was the same as mine, a connection existed to a button previously, and the code in the header was deleted, but the connection was not.
Check the object connections in the view you are segueing to.
You can use associated objects to avoid subclassing. As for the setValue:forKey: and setValue:forUndefinedKey:, take a look in the header file (NSKeyValueCoding.h) for details.
According to your description,
Find newView in your interface builder and right click it,
you will see something like loginButton which is abnormal.
Today I was working and I presented this same error, I used the response of Phillip Mills was correct and I had some labels in one ViewController.xib that were not being assigned links, i have five bad links, once assigned links, everything works perfectly, thanks answer of Phillip Mills.
Go to the connection inspector of your xib of FinalViewWithSending view controller & remove the reference of login button. After that it will run. Try It... :)
Probably, you earlier created the LoginButton, Cmd+Shift+F and find the "LoginButton" and remove the Referencing Outlet and Re-build.
This reply might be late relative to the time the question was asked but I just had this issue and I tried all solution posted here but none worked.
Here is my solution which could help anyone in the future.
Firstly the problem, :I used a custom cell class and made my connections, everything worked fine with my app then, I renamed my custom cell class ran my app but crashed with setValue:forUndefinedKey:] error.
My solution : Clicked .xib file, selected Identity inspector and typed the new named class in Custom Class -> Class tag.
App error resolved.
Related
My on applicationWillFinishLaunching_(aNotification) handler isn't working. It works with my "xib" IB, but it doesn't work with my ".storyboard" IB. Where in the IB should I look? I have searched quite a bit looking for anything that says "applicationWillFinnishLaunching" but no luck. The handler only works if my main storyboard is an ".xib" file but when I make it a ".storyboard" it doesn't work.
Create a new project and check the connection you see in the image below.
Then try to find if the same connection is broken in your project and recreate it.
[IMG]http://i60.tinypic.com/25gto49.png[/IMG]
The title says my error if you are having trouble viewing the image. I have to take snapshots because I do not know when this error message will pop up. This error is not a bug because the exact same error came in a different computer.
Thanks,
Ujjwal
Please check following checklist.
You correct linked to Label in your Storyboard UILabel?
Check you used any undefined variables in your Storyboard xib.
I figured out the answer to my question.
For other people experiencing this problem, here's what you do -
1.Select your View Controller
2.Control + Click on your view controller.
3.If you see any yellow or red signs, click on delete.
This worked really well for me.
Hope it helps,
Ujjwal
I have a stupid problem with Xcode. Sometimes - and I don't know why, because I always follow the same procedure - if I create an IBAction from the nib file of my NSViewController to the .h-file of this NSViewController, I get the error "Could not connect the action buttonCancelClicked: to target of class NSViewController".
It's crazy, because the File's Owner is set to the .h-file and even if I click the button, the IBAction is called. Only Xcode throws this error.
Is this a bug of Xcode? Can I do something to remove this error?
An NSViewController serves to manage NSViews. Disconnect the button first. Declare the action in (maybe another) class, save, and read the header in IB again and connect it in IB the button. That's how I do it and never had a problem.
Another reason that will generate this message is when the class identifier is not pointing to the correct Project. I had copied a class from one project to another.
My initial class identifier looked as follows:
This generated the console messages as shown in the original question.
I set the class then as follows:
This solved the problem.
The full error is: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key.
So I have been trying what other people have been saying with similar problems. I have tried getting rid of every mention of landscapeView in the project, including the Connections in the FIle's Owner in the ViewController_iPhone.xib and then I started fresh by making outlets in the super class ViewController (since I want to use landscapeView and portraitView for iPad also) then I set up connections in ViewController_iPhone.xib and ViewController_iPad.xib to the UIView named Landscape in each respectively, and I still get this error.
I'm just starting out in app development so I'm trying to make a template for an app that is supportive of all orientations on both iPhone and iPad. Thanks for any help
EDIT: Here is a link to all my app delegate h and m and main.m : I am getting the Applications are expected to have a root view controller at the end of application launch error
EDIT 2: So I also tried to make landscapeView a property of ViewController and I made a setter method in ViewController.m but it still has the same problem.
I've found the most common place this error happens is when you instantiate a view from a xib from within a class that is not the xib's owner.
What I mean by this is you might be calling something similar to this:
[[NSBundle mainBundle] loadNibNamed:#"MyView" owner:self options:nil];
You're changing the owner, so you have to be sure that the class that self refers to has all the IBOutlet properties needed by "MyView". Usually this is done in Interface Builder, but in this case you're setting your owner programmatically, which means you can't make the connections in IB. When the IBOutlets aren't there, the app tries to make those connections and fails, giving the error you see.
My advice (without knowing any more info than you've given so far) is to check to see if you've made this call without having the proper IBOutlets.
I had to remove the NIB or XIB (or whatever they are this iteration) for the Main Interface.
It sure would be nice if Apple fully tested the broken software before unleashing it on the unsuspecting public. They could have handled the problem in any number of ways; but instead they chose a runtime crash and obscure [meaningless] error message.
Two main reason is follow
your iboutlet may break please check in storyboard or IB.
if you don't select module for custom class, see into your storyboard.
What I found is I deleted a WebView in viewcontroller.h , but haven't delete the xib file that point to this WebView !
i'm using xcode4.
i have a xib window (perhaps copyed by another one, i forgot because i have made it some times ago) named: chooseCharacter.xib
i have the chooseCharacter.h and .m as view controller (i thought)
i have added
-(IBAction)doneButtonClick;
on the chooseCharacter.h but i've not seen it in interface builder actions...
i have added this on HighScoreViewController.h and it now shows up...
however, if i put it on HighScoreViewController.h i must put the implementation in chooseCharacter.m or i get
-[ChooseCharacter doneButtonClick]: unrecognized selector sent to instance 0xcc0d9b0'
seems that the window is binded with a file's owner that is HighScoreViewController.h but search implementation in ChooseCharacter.m!!!
how can i bind the xib to the right file?
thanks
found it.
selecting in interface builder, file's owner and clicking in identity inspector under class was HighScoreViewController, changed to chooseCharacter now it works