iOS crash log acquisition and symbolization

Source: Internet
Author: User
Tags uicontrol

Get Crash Log

If you don't use a third-party framework, it's hard to collect crash log for iOS apps. There are 2 ways of doing this:

The first way is to ask the user to open the "diagnostic and usage" in the automatic send, and if the app crashes, iOS will pop up a prompt box, after the user confirms, crash log will automatically send to the Apple backstage, and then log on with the developer account, you can get crash log

The second option is to sync the device to itunes, then get the crash log from the PC and send

For detailed steps See:

How to get Crash log

Syncing with ITunes

As you can see, there are 2 ways that are not very reliable, so the realistic approach is to use third-party frameworks, such as Crashlytics. Crash log is automatically collected when the app crashes

Symbolized

After you get crash log, you have to solve the problem of how to read. The original crash log is unreadable and resembles the following:

Last Exception BackTrace:
(0x313b1e83 0x3ba4d6c7 0x312e7d95 0xcef95 0xce843 0x7c6d1 0x3bf320c3 0x3bf377d9 0x3bf379c5 0x3c061dff 0x3c061cc4)

Thread 0:
0 Libsystem_kernel.dylib 0x3bfeaa84 0x3bfea000 + 2692
1 libsystem_kernel.dylib 0x3bfea87d 0x3bfea000 + 2173
2 corefoundation 0x3137c555 0x312dd000 + 652629
3 corefoundation 0X3137ACBB 0x312dd000 + 646331
4 corefoundation 0x312e546d 0x312dd000 + 33901
5 corefoundation 0x312e524f 0x312dd000 + 33359
6 graphicsservices 0x35fe62e7 0x35fdf000 + 29415
7 UIKit0x33b9a841 0x33b2b000 + 456769

Such a log, even if it is almost meaningless, the positioning problem does not help, so you need to symbolize the crash log

In general, any app crash log in Xcode can be partially symbolized, that is, uikit,corefoundation this system-level library, but to really get a fully symbolic crash log, need to meet 2 conditions:

1. Binary Package with app

2. dsym files obtained when compiling this binary package

As long as the app has been compiled by the machine, should be satisfied with this condition. Then you can import the. IPs or. crash file into Xcode, which is automatically symbolized, and after it is fully symbolized, the crash log is readable:

Last Exception BackTrace:
0 corefoundation 0x183cba950 __exceptionpreprocess + 132
1 LIBOBJC. A.dylib0X1905701FC Objc_exception_throw + 60
2 corefoundation 0x183bbc218-[__nsarrayi Objectatindex:] + 204
3 testnotification 0X100029CFC-[mainviewcontroller clicked1] (mainviewcontroller.m:42)
4 UIKit0X186CB90C8-[uiapplication sendAction:to:from:forEvent:] + 100
5 UIKit0x186cb905c-[uiapplication sendAction:toTarget:fromSender:forEvent:] + 24
6 UIKit0x186ca2538-[uicontrol _sendactionsforevents:withevent:] + 376
7 UIKit0X186CB8A5C-[uicontrol touchesended:withevent:] + 584
8 UIKit0X186CB86F0-[uiwindow _sendtouchesforevent:] + 692
9 UIKit0x186cb3388-[uiwindow sendevent:] + 1172
Ten UIKit0x186c84b68-[uiapplication sendevent:] + 256
UIKit0X186C82C58 _uiapplicationhandleeventqueue + 8500
Corefoundation 0x183c7b044 __cfrunloop_is_calling_out_to_a_source0_perform_function__ + 24
Corefoundation 0X183C7A3A0 __cfrunloopdosources0 + 256
Corefoundation 0x183c78638 __cfrunlooprun + 632
Corefoundation 0x183bb96d0 Cfrunlooprunspecific + 452
Graphicsservices 0x189845c0c Gseventrunmodal + 168
UIKit0X186CEAFDC Uiapplicationmain + 1156
Testnotification 0x100029990 Main (main.m:16)
Libdyld.dylib0X190B63AA0 Start + 4

Thread 0 Crashed:
0 Libsystem_kernel.dylib 0x0000000190c5e58c __pthread_kill + 8
1 libsystem_c.dylib0x0000000190bf2804 Abort + 108
2 Libc++abi.dylib0x000000018fe18990 Abort_message + 84
3 Libc++abi.dylib0x000000018fe35c28 Default_terminate_handler () + 296
4 LIBOBJC. A.dylib0x00000001905704d0 _objc_terminate () + 124
5 Libc++abi.dylib0x000000018fe33164 std::__terminate (void (*) ()) + 12
6 Libc++abi.dylib0X000000018FE32D38 __cxa_rethrow + 140
7 LIBOBJC. A.dylib0X00000001905703A4 Objc_exception_rethrow + 40
8 Corefoundation 0x0000000183bb9748 Cfrunlooprunspecific + 572
9 graphicsservices 0X0000000189845C08 Gseventrunmodal + 164
Ten UIKit0x0000000186ceafd8 Uiapplicationmain + 1152
Testnotification 0x000000010002998c Main (main.m:16)
Libdyld.dylib0x0000000190b63a9c Start + 0


Line3 can clearly see that the crash occurred in the Mainviewcontroller 42 lines, about dSYM introduction, see this article: Crash log

So the best way to do this is to use a third-party framework. In Crashlytics, for example, it would require the integration of a script in Xcode's compilation process, which would basically send binary packages and dsym to Crashlytics's website so that when Crashlytics gets the crash log, It can be fully symbolized.

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.