"Go" iOS development------Use the Xcode compiler to locate the location that throws the exception-good!!!

Source: Internet
Author: User

Original URL: http://blog.csdn.net/runintolove/article/details/51297734

Although objective-c the exception is encapsulated, but the daily knock code, often because of sloppy, the code snippet appeared a little bit of error, but they can not find. Of course, most of the time, Xcode will direct the error (that is, as the saying goes) to tell us, this time as long as the exception stack according to the report, you can find the exact location of the error.

But there is a situation, I believe you must have encountered, the program does not collapse or collapse but did not tell us the exception stack, but the cause of the error tells us:

First throw call stack: (0x18336ae380x1829cff800x183e2495c0x183ca59680x183ca55500x183ca51000x1004cbdcc0x1004cb454 0x1884a80e4  0x185e4ea28 0x185e49634 0x185e494f4 0x185e48b24 0x185e4886c  0X1884AAEF4 0x183321124 0x183320bb8 0x18331e8b8 0x183248d10  0x184b30088 0x188515f70 0x1004c2e34 0x1libc++abi.dylib:terminating with uncaught exception of type Span class= "Hljs-title" >nsexception           
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

From the code point of view, we are sure that somewhere throws an exception, but "somewhere" for the programmer is not very collapse, in short, the landlord will be very collapsed, although the end can find the abnormal trigger point, but always waste a lot of development time. Here is how to get Xcode to help us automatically navigate to the exception throw location, to save development time, hope to help to see the blog friends.

Have to say that xcode this compiler is really very powerful, their understanding of it more and more self-awareness is not enough, this situation, the corresponding breakpoint settings for Xcode, you can position the code to throw the exception, when the exception thrown, Xcode directly to the code line:

1, find the breakpoint group of Xcode, find the lower left corner of the + key, location such as:



2, click the + key, can add a new breakpoint, the project is objective-c, so add an exception breakpoint here, of course, Swift can also add an error breakpoint, according to different circumstances can be customized to add.



3, after the addition, there will appear a global breakpoint, from the following description can be seen, this breakpoint is all the exception breakpoint.



After the setup is complete, the program that throws the exception is run again, and the breakpoint is automatically stuck on the statement that throws the exception:



So developers don't have to spend a lot of time looking for an exception throw when they don't see the exception stack.Thanks()

"Go" iOS development------Use the Xcode compiler to locate the location that throws the exception-good!!!

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.