iOS程式崩潰日誌

2021-07-13 18:01:00 字數 3746 閱讀 6606

void uncaughtexceptionhandler(n***ception exception) ; }
當然你還要在以下方法中新增呼叫

nssetuncaughtexceptionhandler (&uncaughtexceptionhandler);//錯誤日誌收集}

下面時陣列越界時返回的錯誤日誌

arr = (

"0 corefoundation 0x0000000182a69918 + 148",

"1 libobjc.a.dylib 0x00000001820d7f80 objc_exception_throw + 56",

"2 corefoundation 0x000000018294fac4 cfrunloopremovetimer + 0",

"3 你的程式 0x0000000100095d00 -[secviewcontroller viewdidload] + 1124",崩潰的具體地點

"4 uikit 0x000000018775c0c0 + 996",

"5 uikit 0x000000018775bcc4 + 28",

"6 uikit 0x0000000188026ca0 + 92",

"7 uikit 0x0000000187ab30dc + 136",

"8 uikit 0x0000000187ad8c24 + 3780",

"9 uikit 0x0000000187adb9c0 + 472",

"10 uikit 0x0000000187855cec + 184",

"11 uikit 0x0000000187e946f0 + 252",

"12 uikit 0x0000000187e8763c + 456",

"13 uikit 0x0000000187e87440 + 92",

"14 uikit 0x0000000187e87708 + 160",

"15 uikit 0x0000000187793e50 + 100",

"16 uikit 0x0000000187793dcc + 80",

"17 uikit 0x000000018777ba88 + 416",

"18 uikit 0x00000001877936e4 + 572",

"19 uikit 0x0000000187793314 + 804",

"20 uikit 0x000000018778be30 + 784",

"21 uikit 0x000000018775c4cc + 248",

"22 uikit 0x000000018775a794 + 5528",

"23 corefoundation 0x0000000182a20efc + 24",

"24 corefoundation 0x0000000182a20990 + 540",

"25 corefoundation 0x0000000182a1e690 + 724",

"26 corefoundation 0x000000018294d680 cfrunlooprunspecific + 384",

"27 graphicsservices 0x0000000183e5c088 gseventrunmodal + 180",

"29 zhongrongjinfubeta 0x0000000100098548 main + 124",

"30 libdyld.dylib 0x00000001824ee8b8 + 4"

);

name = nsrangeexception;崩潰的型別

崩潰的具體原因

reason = "*** -[__nsarrayi objectatindex:]: index 4 beyond bounds [0 .. 2]";

現在崩潰日誌已經收集到了,我們要做什麼處理呢有兩個選擇:

一:上傳到伺服器 把資訊崩潰的資訊儲存為字典,上傳到伺服器 **如下:

nsmutableurlrequest requset = [[nsmutableurlrequest alloc]initwithurl:[nsurl urlwithstring:@"上傳到的位址"]];

requset.httpmethod = @"post"; // 傳送請求

[nsurlconnection sendasynchronousrequest:requset queue:[nsoperationqueue mainqueue] completionhandler:^(nsurlresponse *response, nsdata *data, nserror *connectionerror) else

}];

二:儲存到本地

nsstring path = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes).firstobject; 

/儲存的格式和名稱「/」表示儲存到目錄中

[dic writetofile:fullpath atomically:no];

讀取檔案:

nsdictionary *dicc = [[nsdictionary alloc]initwithcontentsoffile:fullpath];//fullpath儲存的位址

現在也有一些第三方服務提供錯誤日誌的收集,而且蘋果本身也有這個服務。所以現在更多的側重點就放在了錯誤日誌的分析上,至於錯誤日誌的分析,以後在做分析

IOS崩潰日誌

1.普通崩潰日誌 參考 1 程序資訊 incident identifier 30e46451 53fd 4965 896a 457fc11ad05f 崩潰報告的唯一識別符號 是與裝置標識相對應的唯一鍵值。雖然它不是真正的裝置識別符號,但也是乙個非常有用的情報 如果你看到100個崩潰日誌的crash...

ios崩潰日誌收集 iOS崩潰日誌收集與解析

收集crash日誌方式 1.裝置上直接檢視 路徑 設定 隱私 分析 分析資料 2.xcode獲取裝置上資訊 路徑 xcode選單欄window devices and simulators 選中裝置 view device logs 3.xcode獲取發布版本崩潰資訊 路徑 xcode選單欄wind...

iOS應用崩潰(三) 崩潰日誌

當我們在模擬器上除錯時,可能經常遇到下面的記憶體訪問錯誤 該錯誤是對乙個已經釋放的物件進行操作,定位如下 2 終端輸入 info malloc history 命令,即可得到堆疊資訊,從而分析具體問題所在 gdb info malloc history 0x12e4b0 3 也可輸入如下資訊 gdb...