IPhone application crash (I)

Source: Internet
Author: User

It is common for iPhone application development to encounter crashes. Of course, some problems are simple but not necessarily identified. The reason is very simple. The problem occurs with our operation errors. Of course, some problems are troublesome. The following is a crash issue.

Terminating app due to uncaught exception 'nsunknownkeyexception', reason: '[<sendmessageviewcontroller 0x24b260> setvalue: forundefinedkey:]: This class is not key value coding-compliant for the key m_image_body .'

* ** Call stack at first throw:

(

......

)

Terminate called after throwing an instance of 'nsexception'

 

In fact, this is a basic template for the crash. The page for the crash is listed. The above crash is on the sendmessageviewcontroller page, and then the problematic function is provided: setvalue: forundefinedkey: a problem that occurs during function execution. The name of the Class-Defined Object m_image_body is also provided later. Of course, the reason for this exception is not the only one. Here we only talk about this situation.

When we see this exception, the first response is to find the setvalue: forundefinedkey: function on the sendmessageviewcontroller page, but we didn't find this function. It was a bit strange. Later, we checked m_image_body, I searched the entire project, but found that. the H file has a definition, and it is also a comment-out definition. Without any operation, I still feel a bit strange at first, but I will find the problem after reading it for a while, first, can you find the problem in the definition of the problem?

// Iboutlet uiimageview * m_image_body;

Maybe not. The reason is very simple, because this page was written by another person, and I did the operation to comment out it, So I confirmed the problem here, you may have noticed the problem. There is an iboutlet in the comment-out definition. Imagine that iboutlet is used to tell XIB so that XIB can recognize this object, so we naturally started to think about XIB. Is there any operation on this object in XIB? It turns out that XIB actually links this interface, but we didn't define it, which leads to an exception. The problem is solved.

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.