Unrecognized selector sent to instance

Source: Internet
Author: User

Today, I encountered a terrible problem,

I used xib to create the button control and connected it. There is no problem, that is, when I click button action during the operation, the system will crash and"

Unrecognized selector sent to instance
". For some reason, I read the code carefully. A: Is it my xib connection wrong?
I got it again, but it still doesn't work. I'm depressed.

I deleted the file and created it. It still doesn't work. What's wrong !!!

Later I found the cause. My controller declared as a local variable during the call, and the system could not find the correct controller.

This is not a pitfall, dizzy, it took an hour to get this thing. But I also learned that I used to write code directly on the interface before. I switched to this header and had a good tool. Instead, I was not used to it.

If you encounter this problem, do not write the controller as a local variable. (Xib is not required)

From the column diqun1314
 

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.