Cause
Many people commented on some crash messages and asked me what happened to the program. In fact, if you know where the code crashed, it would be easy to locate the problem. Android Developers can see which line of code has a problem by looking at the crash log, so how can I quickly find the specific line of code crash in iOS development.
Step 1
Add a general breakpoint in xcode. The method is as follows:
Click the project navigation breakpoint,
Step 2
Click +:
Follow the steps shown above to complete the operation.
Run the program again
The breakpoint automatically comes here,
The log information is:
11:14:19. 635 gesturerecognizer [1491: c07]-[_ nscfnumber is1_tostring:]: Unrecognized selector sent to instance 0x7a88df02013-05-20 11:15:21. 148 gesturerecognizer [1491: c07] *** terminating app due to uncaught exception 'failed', reason: '-[_ nscfnumber isequaltostring:]: Unrecognized selector sent to instance 0x7a88df'
This is easy to find that the program crashes because the value does not have the isequaltostring method.
If I do not add the above general breakpoint, the program will directly break the breakpoint to the main function.
PS: This method can only crash in most cases. A few errors cannot be broken.