友盟提供了强大的错误收集功能,利用错误详情来定位到我们代码中的错误位置,在此记录一下:
错误详情:
-[__NSCFString containsString:]: unrecognized selector sent to instance 0x15daada0 (null) (( 0 CoreFoundation 0x2e55ff9b + 154 1 libobjc.A.dylib 0x38d10ccf objc_exception_throw + 38 2 CoreFoundation 0x2e563917 + 202 3 CoreFoundation 0x2e562203 + 706 4 CoreFoundation 0x2e4b1768 _CF_forwarding_prep_0 + 24 5 ***** 0x953b1 ***** + 594865 6 ***** 0xa6f57 ***** + 667479 7 UIKit 0x30db2037 + 90 8 UIKit 0x30f18c45 + 120 9 UIKit 0x30db2037 + 90 10 UIKit 0x30db1fd7 + 30 11 UIKit 0x30db1fb1 + 44 12 UIKit 0x30d9d717 + 374 13 UIKit 0x30db1a2f + 590 14 UIKit 0x30db1701 + 528 15 UIKit 0x30dac6cb + 758 16 UIKit 0x30d818cd + 196 17 UIKit 0x30d7ff77 + 7102 18 CoreFoundation 0x2e52b20b + 14 19 CoreFoundation 0x2e52a6db + 206 20 CoreFoundation 0x2e528ecf + 622 21 CoreFoundation 0x2e493ebf CFRunLoopRunSpecific + 522 22 CoreFoundation 0x2e493ca3 CFRunLoopRunInMode + 106 23 GraphicsServices 0x33399663 GSEventRunModal + 138 24 UIKit 0x30de014d UIApplicationMain + 1136 25 ***** 0xd5b63 ***** + 858979 26 libdyld.dylib 0x3921dab7 + 2 ) dSYM UUID: B1AB4CD3-1E60-3EAD-949D-8626046421E6 CPU Type: armv7 Slide Address: 0x00004000 Binary Image: ***** Base Address: 0x000e2000
错误定位操作步骤如下:
1. 在Archives中选中打包的APP,show in finder -->显示包内容-->在dSYMs 中有 xxxxxx.app.dSYM ,在Products/Applications 有xxxxxx.app 把这2个文件放在同一个文件夹里面。
2.打开终端 cd 到这个文件目录下
3.输入指令
xcrun atos -arch armv7 -o xxxxxx.app/xxxxxx 0x953b1
其中:
armv7为错误日志中对应的CUP Type:armv7
0x953b1为错误内存地址,一般为友盟错误详情中可以点击的第一个项目内存地址