在作的項目中,用到了友盟的組件,在沒有禁用錯誤日誌上傳以前,收集了一些錯誤日誌。
有一些朋友看到了錯誤日誌,殊不知道怎麼定位到程序的的代碼中,實際上,這一步是很是的簡單。
友盟沒有集成.dSYM文件,只能顯示錯誤的地址,沒法顯示詳細的信息。
準備步驟,
1,友盟錯誤日誌app
*** -[__NSArrayM objectAtIndex:]: index 20 beyond bounds [0 .. 19] (null) ( "0 CoreFoundation 0x371308bf __exceptionPreprocess + 162", "1 libobjc.A.dylib 0x317fe1e5 objc_exception_throw + 32", "2 CoreFoundation 0x37079b6b -[__NSArrayM objectAtIndex:] + 270", "3 aaaaa 0x0004af6f aaaaa + 302959", "4 UIKit 0x3277d565 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 944", "5 UIKit 0x327f5ce7 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 158", "6 Foundation 0x31ba0943 __NSFireDelayedPerform + 414", "7 CoreFoundation 0x37104a63 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14", "8 CoreFoundation 0x371046c9 __CFRunLoopDoTimer + 364", "9 CoreFoundation 0x3710329f __CFRunLoopRun + 1206", "10 CoreFoundation 0x370864dd CFRunLoopRunSpecific + 300", "11 CoreFoundation 0x370863a5 CFRunLoopRunInMode + 104", "12 GraphicsServices 0x3123cfcd GSEventRunModal + 156", "13 UIKit 0x326f8743 UIApplicationMain + 1090", "14 aaaaa 0x00003687 aaaaa + 9863", "15 aaaaa 0x00003144 aaaaa + 8516" )
2.找到.dSYM文件,在編譯程序時,會自動生成這個文件,
3.把應用 aaaaaa.app和 .dSYM文件放到一個目錄中,
執行 oop
atos -arch armv7 -o 'aaaaaa.app/aaaa' -l 0x0004af6f
這樣就獲得了程序錯誤的對應的源代碼地址。
--------------------------------------
固然,若是你的程序很複雜,友盟的功能確定不夠使用。
友盟沒法返回詳細的信息,Binary Images, Thread 0 crashed with ARM Thread State.. 更主要的是,很許多的錯誤代碼友盟沒法收集,也沒法收集更多的信息。
這時,你就須要更專業的日誌處理方法。日誌