IOS Common error Handling 1setvalue:forundefinedkey

Source: Internet
Author: User

Workaround for running the following error in iOS

Terminating app due to uncaught exception ' nsunknownkeyexception ', Reason: ' [<viewcontroller 0x198620 > Setvalue:forundefinedkey:]: This class was not key value Coding-compliant for the key btn. '

Call stack at first throw:

and the Xcode code runs to the Uiapplicationdelegate [self.windowmakekeyandvisible]; When stopped, prompt program received signal "SIGABRT"

The root cause of this problem is that a control in the Xib has been connected to a variable in the Viewcontroller by outlet, and then the variable is deleted, but the connection is not deleted, causing the corresponding key to be found at startup and throwing the exception above.

The solution is as follows:

Locate the controller corresponding to the Xib, and right-click to see if the property associated with a control already does not exist:

Such as:

See if the corresponding property is in Viewcontroller. H also exists, if there is no difference on the red line in the click, Delete the association, and then pull the cable again

IOS Common error Handling 1setvalue:forundefinedkey

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.