Terminating app due to uncaught exception ' nsunknownkeyexception ', reason:xxxx

Source: Internet
Author: User

Scenario where the error occurred:

Use Swift to customize the cell and then use the cell in OC, because you can name the comparison specification for use and use in OC.

I added @objc (Dsproductcell) before Swift's custom cell

The full version is this:

@objc(Dsproductcell) class Productcell: uitableviewcell {}

Then build the cell on the xib ...

Then this error occurs when OC is used ...

Finally, troubleshoot the cause of this problem:

The class in xib is not prefixed, it is the default is Productcell, need to change: Dsproductcell

After compiling or not, clean a bit, in the compilation, you can ...

So you need to be careful when you use it here.

There is also a need to pay attention to the place, is TableView in registernib, Nibname is the name of the Xib file,

Note that it is the Xib file name, such as Productcell.xib, when the register is:

[self. TableView registernib: [uinib nibwithnibname:@ "Productcell" Bundle :Nil] forcellreuseidentifier:reuseidentifier];

Terminating app due to uncaught exception ' nsunknownkeyexception ', reason:xxxx

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.