Ios crash log acquisition and symbolic

Source: Internet
Author: User
Tags uicontrol

Get crash log

Without a third-party framework, it is very difficult to collect the crash logs of ios apps. There are two methods:

The first method is to ask the user to enable automatic sending in "diagnosis and usage". If the APP crashes, a prompt box will pop up in ios. After the user confirms, the crash log will be automatically sent to the Apple background, then log in with the developer account to obtain the crash log.

The second method is to synchronize the device to iTunes, get the crash log from the pc, and then send

For detailed steps, see:

How to get crash log

Syncing with iTunes

We can see that the two methods are not reliable, so the actual method is to use a third-party framework, such as Crashlytics. The crash log is automatically collected when the app crashes.

Symbolic

After obtaining the crash log, we need to solve the problem of reading. The original crash log is unreadable, And the content is similar to this:

Last Exception Backtrace:
(0x313b1e83 0x3ba4d6c7 0x312e7d95 0xcef95 0xce843 0x7c6d1 0x3bf320c3 0x3bf377d9 0x3bf1_c5 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 UIKit 0x33b9a841 0x33b2b000 + 456769

Such a log is meaningless even if it is obtained and does not help in locating the problem. Therefore, the crash log must be symbolic.

Generally, the crash log of any app can be partially symbolic in xcode, that is, a system-level library such as UIKit and CoreFoundation. However, to truly obtain a fully symbolic crash log, two conditions must be met:

1. Binary Package with app

2. There is a dSYM file obtained when this binary package is compiled.

This condition should be met by machines that have compiled the app. Import the obtained. ips or. crash file to xcode, and the file will be automatically symbolic. After it is fully symbolic, the crash log will be readable:

Last Exception Backtrace:
0 CoreFoundation 0x183cba950 _ predictionpreprocess + 132
1 libobjc. A. dylib 0x1905701fc objc_exception_throw + 60
2 CoreFoundation 0x183bbc218-[_ NSArrayI objectAtIndex:] + 204
3 TestNotification 0x100029cfc-[MainViewController clicked1] (MainViewController. m: 42)
4 UIKit 0x186cb90c8-[UIApplication sendAction: to: from: forEvent:] + 100
5 UIKit 0x186cb905c-[UIApplication sendAction: toTarget: fromSender: forEvent:] + 24
6 UIKit 0x186ca2538-[UIControl _ sendActionsForEvents: withEvent:] + 376
7 UIKit 0x186cb8a5c-[UIControl touchesEnded: withEvent:] + 584
8 UIKit 0x186cb86f0-[UIWindow _ sendTouchesForEvent:] + 692
9 UIKit 0x186cb3388-[UIWindow sendEvent:] + 1172
10 UIKit 0x186c84b68-[UIApplication sendEvent:] + 256
11 UIKit 0x186c82c58 _ UIApplicationHandleEventQueue + 8500
12 CoreFoundation 0x183c7b044 _ cfrunloop_is_calling_out_to_a_source0_1_m_function _ + 24
13 CoreFoundation 0x183c7a3a0 _ CFRunLoopDoSources0 + 256
14 CoreFoundation 0x183c78638 _ CFRunLoopRun + 632
15 CoreFoundation 0x183bb96d0 CFRunLoopRunSpecific + 452
16 GraphicsServices 0x189845c0c GSEventRunModal + 168
17 UIKit 0x186ceafdc UIApplicationMain + 1156
18 TestNotification 0x100029990 main (main. m: 16)
19 libdyld. dylib 0x0000b63aa0 start + 4

Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000109c5e58c _ pthread_kill + 8
1 libsystem_c.dylib 0x0000000108bf2804 abort + 108
2 libc ++ abi. dylib 0x000000018fe18990 abort_message + 84
3 libc ++ abi. dylib 0x000000018fe35c28 default_terminate_handler () + 296
4 libobjc. A. dylib 0x00000001905704d0 _ objc_terminate () + 124
5 libc ++ abi. dylib 0x000000018fe33164 std ::__ terminate (void (*) () + 12
6 libc ++ abi. dylib 0x000000018fe32d38 _ cxa_rethrow + 140
7 libobjc. A. dylib 0x00000001905703a4 objc_exception_rethrow + 40
8 CoreFoundation 0x0000000183bb9748 CFRunLoopRunSpecific + 572
9 GraphicsServices 0x0000000189845c08 GSEventRunModal + 164
10 UIKit 0x0000000186ceafd8 UIApplicationMain + 1152
11 TestNotification 0x000000010002998c main (main. m: 16)
12 libdyld. dylib 0x0000000492b63a9c start + 0


Line3 clearly shows that the crash occurred in line 42 of MainViewController. For details about dSYM, see this article: crash log

So the best way is to use a third-party framework. Taking Crashlytics as an example, it requires that a script be integrated during xcode compilation. The role of this script is to send the Binary Package and dSYM to the website of Crashlytics, in this way, after Crashlytics obtains the crash log, it can be fully symbolic.

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.