[IOS] xcode4/ios5 solution for uncaughtexception crash when the first throw call stack does not print the method name

Source: Internet
Author: User

When I recently connected ios5.0.1 to a real machine for debugging, I found that uncaughtexception caused crash and then *** first throw call Stack: No readable call stack is printed, the detailed call method name and other information will be displayed after the previous crash, but now there are a bunch of memory addresses 0x ..... 0x ......

I didn't know what was going on at first, and I didn't seem to have met it before. Google once saw an articleArticle(Http://stackoverflow.com/questions/7841610/xcode-4-2-debug-doesnt-symbolicate-stack-call) it seems that ios5.0 started to make some changes, resulting in the method name cannot print. However, there are also remedial measures:

Define a method by yourself:

Static void uncaughtexceptionhandler (nsexception * exception ){

Nslog (@ "crash: % @", exception );

Nslog (@ "stack trace: % @", [Exception callstacksymbols]);

// Internal Error Reporting

}

ThenProgramCall during initialization (for example, put it in-(bool) Application :( uiapplication *) Application didfinishlaunchingwitexceptions :( nsdictionary *) the first line in launchoptions ):

Nssetuncaughtexceptionhandler (& uncaughtexceptionhandler );

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.