Common crash scenarios for iOS and bug debug workarounds

Source: Internet
Author: User

This blog will be updated from time to time, I will be in the project to organize the breakdown of common crashes after sharing to everyone:

1.unrecognized Seletor. Error: This is a simple situation where a message is sent to an object that it does not know. For example, your. h declares a method, but there is no implementation in. m, and you do not have the Exception message processing (message forwarding) to cause this behavior. WORKAROUND: First troubleshoot whether some of your own methods are implemented, and then see which objects receive messages that they should not receive.

2.index 1 Beyond Nsarramu [0,0] array out of bounds: array out of bounds that's not much to say.

3.NSNul length This exception can be categorized as the first and an unrecognized message is sent to an object. Common reasons are: The text is set to the Uilabel object, the text content is empty string null, and then you take the length of text to throw an exception.

4.exc_bad_access Exceptions: Most of this is an error that the object is released early and accesses the wild pointer. WORKAROUND: Troubleshoot all claims that are declared as weak objects, whether you have accessed the object again without holding it (the object has been disposed), and second in the MRC case, troubleshoot the object that has already been released (declare a point, The global variables in the MRC are best released in the Dealloc method, and the third is to check all blocks, whether the block is properly assigned, and so on.

5. Crash in the main function. This is the hardest and hardest to find the bug, in which case the main function is wrapped with @try @catch, which throws the exception stack information, or by adding a global breakpoint to track the bug.


Welcome to iOS Technology group: Love Crazy, Love coding group number: 209476515

Common crash scenarios for iOS and bug debug workarounds

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.