iOS development solves crash problems by analyzing UMeng error details

iOS development solves crash problems by analyzing UMeng error details

It’s important to get crash information in your project. After iOS development, debugging and launch, programs often crash. The more common third-party crash analysis tools are Umeng, Baidu, crashlytics, etc. Third-party crash analysis tools even have the function of symbolic crash logs. The more commonly used ones include Crashlytics, Flurry, etc.

##Find out where the crash code is located

In the Crash statistics of allies, it is sometimes difficult to see where crashes occur. So we need to find out where the code that crashed is located.
For example – [NSNull length]: unrecognized selector sent to instance 0x3a675a60

-[NSNull length]: unrecognized selector sent to instance 0x3a675a60
(null)
(
0 CoreFoundation 0x2f70fee3 <redacted> + 154
1 libobjc.A.dylib 0x39eaace7 objc_exception_throw + 38
2 CoreFoundation 0x2f7137f7 <redacted> + 202
3 CoreFoundation 0x2f7120f7 <redacted> + 706
4 CoreFoundation 0x2f661058 _CF_forwarding_prep_0 + 24
5 Views 0x3f55e3 Views + 4134371
6 Views 0xce63f Views + 828991
7 UIKit 0x31f766a7 <redacted> + 90
8 UIKit 0x320dd56d <redacted> + 120
9 UIKit 0x31f766a7 <redacted> + 90
10 UIKit 0x31f76643 <redacted> + 38
11 UIKit 0x31f76613 <redacted> + 46
12 UIKit 0x31f61d5b <redacted> + 374
13 UIKit 0x31f7605b <redacted> + 594
14 UIKit 0x31f75d2d <redacted> + 528
15 UIKit 0x31f70c87 <redacted> + 758
16 UIKit 0x31f45e55 <redacted> + 196
17 UIKit 0x31f44521 <redacted> + 7120
18 CoreFoundation 0x2f6dafaf <redacted> + 14
19 CoreFoundation 0x2f6da477 <redacted> + 206
20 CoreFoundation 0x2f6d8c67 <redacted> + 630
21 CoreFoundation 0x2f643729 CFRunLoopRunSpecific + 524
22 CoreFoundation 0x2f64350b CFRunLoopRunInMode + 106
23 GraphicsServices 0x345b26d3 GSEventRunModal + 138
24 UIKit 0x31fa4871 UIApplicationMain + 1136
25 Views 0x277f77 Views + 2572151
26 libdyld.dylib 0x3a3a8ab7 <redacted> + 2
)

dSYM UUID: DF56542E-9A22-323A-AB92-66DDB8217241
CPU Type: armv7
Slide Address: 0x00004000
Binary Image: Views
Base Address: 0x000f5000

In the crash log above, we can see that the crashed code line cannot be directly located.

## Next we will find out the problem through the command

  • 1. Find the archive file *.xcarchive when the packaged application was released. Find the *.dSYM file in the dSYMs folder and copy it.
  • 2. Open the terminal and cd to the folder where the *.dSYM file is located.
  • 3. Find the uuid of the corresponding response through the command dwarfdump –uuid appname.app.dSYM
1deMac-mini-2:dysm a1$ dwarfdump --uuid 4.0.3_Views.app.dSYM
UUID: DF56542E-9A22-323A-AB92-66DDB8217241 (armv7) 4.0.3_Views.app.dSYM/Contents/Resources/DWARF/Views
UUID: 1D53917F-B39C-3FBB-BDD4-3802F7372CD1 (arm64) 4.0.3_Views.app.dSYM/Contents/Resources/DWARF/Views

  • 4. Find the dSYM UUID in the crash error details among among: DF56542E-9A22-323A-AB92-66DDB8217241, as shown in the figure below

  • 5. Compare whether the uuid is consistent. If it is consistent, it means that the package and crash match.
  • 6. You can see the problem by running the command dwarfdump –arch=armv7 –lookup 0x3f55e3 4.0.3_Views.app.dSYM
1deMac-mini-2:dysm a1$ dwarfdump --arch=armv7 --lookup 0x3f55e3 4.0.3_Views.app.dSYM
-------------------------------------------------- -------------------
 File: 4.0.3_Views.app.dSYM/Contents/Resources/DWARF/Views (armv7)
-------------------------------------------------- -------------------
Looking up address: 0x00000000003f55e3 in .debug_info... found!

0x0038a04b: Compile Unit: length = 0x0000065e version = 0x0002 abbr_offset = 0x00000000 addr_size = 0x04 (next CU at 0x0038a6ad)

0x0038a056: TAG_compile_unit [106] *
             AT_producer( "Apple LLVM version 8.0.0 (clang-800.0.38)" )
             AT_language(DW_LANG_ObjC)
             AT_name( "/Users/a1/Desktop/ios/ios/Views/Views/Controllers/Browser/BrowserViewController + Ex.m" )
             AT_stmt_list(0x001f699f)
             AT_comp_dir( "/Users/a1/Desktop/ios/ios/Views" )
             AT_APPLE_optimized(0x01)
             AT_APPLE_major_runtime_vers(0x02)
             AT_low_pc(0x003f52b0)
             AT_high_pc(0x003f5850)

0x0038a40d: TAG_subprogram [117] *
                 AT_low_pc(0x003f53e2)
                 AT_high_pc(0x003f581c)
                 AT_frame_base( r7 )
                 AT_object_pointer( {0x0038a429} )
                 AT_name( "-[BrowserViewController(Ex) getShareModel:]" )
                 AT_decl_file( "/Users/a1/Desktop/ios/ios/Views/Views/Controllers/Browser/BrowserViewController + Ex.m" )
                 AT_decl_line(17)
                 AT_prototyped(0x01)
                 AT_type( {0x0038a53f} ( ShareModel* ) )
                 AT_APPLE_optimized(0x01)
                 AT_APPLE_isa(0x01)
Line table dir: '/Users/a1/Desktop/ios/ios/Views/Views/Controllers/Browser'
Line table file: 'BrowserViewController + Ex.m' line 29, column 55 with start address 0x00000000003f55d0

Looking up address: 0x00000000003f55e3 in .debug_frame... found!

0x00067490: FDE
        length: 0x0000000c
   CIE_pointer: 0x00000000
    start_addr: 0x003f53e2 -[BrowserViewController(Ex) getShareModel:]
    range_size: 0x0000043a (end_addr = 0x003f581c)
  Instructions: 0x003f53e2: CFA=sp


1deMac-mini-2:dysm a1$


From the log above, we can see where the problem lies. The crash occurs at line 29 of BrowserViewController + Ex.m. And you can see the crash problem from start_addr: 0x003f53e2 -[BrowserViewController(Ex) getShareModel:].

As shown below:

This article is a learning record. If there is anything wrong, please leave a message.