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