Common iOS crashes and bug debugging solutions, and iosbug debugging Solutions

Source: Internet
Author: User

Common iOS crashes and bug debugging solutions, and iosbug debugging Solutions

This blog will be updated from time to time. I will sort out common crashes in projects and share them with you:

1. unrecognized seletor. Error: this situation is very simple. A message is sent to an object that it does not know. For example, if you declare a method in. h, but it is not implemented in. m, and you do not process the exception message (Message forwarding), this will happen. Solution: First, check whether some of your methods are implemented. Second, check which objects receive messages that they do not receive.

2. index 1 beyond NSArraMu [] array out-of-bounds: array out-of-bounds.

3. The NSNul length exception can be classified as the first type. It also sends an unrecognized message to an object. Common causes are: text is set for the UILabel object. The text content is null, and an exception is thrown when you get the length of text.

4. Exception in EXC_BAD_ACCESS: most of these are objects that are released in advance and access to the wild pointer is incorrect. Solution: Check the usage of all declared weak objects, whether the object is accessed again without being held (the object has been released), and second, in the case of MRC, check the objects that have been release (declare that the global variables in MRC should be released in the dealloc method), and check all blocks and whether the blocks are assigned normally.

5. The main function crashes. In this case, it is the hardest and most difficult to find the bug. In this case, wrap the main function with @ try @ catch, which will throw exception stack information, etc, you can also add a Global breakPoint to track bugs.


Welcome to the iOS technology exchange group: AI crazy, AI Coding group number: 209476515

Related Article

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.