What is MetrickitMetricKit is a tool introduced by Apple in iOS 13 that aggregates and analyzes reports on each device regarding exception and crash diagnostics as well as power and performance metrics. Why use MetricKit to collect crash logsCurrently, some open source frameworks on the market, such as KSCrash and PLCrashReport, cannot capture some crashes. For example, PLCrashReport cannot capture stack overflow crashes, SIGKILL, SIGQUIT and other signal crashes. KSCrash can only capture part of SIGKILL crashes. Metrickit flaws
The crash log of iOS14 will be called back once every 24 hours, which has low timeliness. After iOS15, the crash log will be returned after the next startup, but it has been verified that some will be called back immediately, while others will not, and the pattern is unpredictable. Start access1. Add MetricKit 2. Add MetricKit listeners if ( @ available ( iOS 14.0 , * )) { 3. The listener implements the MXMetricManagerSubscriber protocol method. The payloadDic contains the last crash log stack and information of this application. // If Apple has data, it will call back after registering the monitor 4. Log assembly key code examples NSArray * callStackRootFrames = [ dicFrame ArrayValueForKey : kMetrkitCallStackRootFramesKey ]; MetricKit return fields meaning and detailsJSON overall format crashDiagnostics DetailsEach crash is a dictionary with the following contents: diagnosticMetaData dictionary details| terminationReason | String | Crash reason | RBSTerminateContext domain : 10 code : 0x8BADF00D callStackTree dictionary detailscallStacks array detailsThe elements in the array are dictionaries, as follows callStackRootFrames array detailsThe elements in the array are dictionaries, as follows diskWriteExceptionDiagnostics DetailsEach crash is a dictionary with the following contents: diagnosticMetaData dictionary detailscallStackTree dictionary detailscallStacks array detailsThe elements in the array are dictionaries, as follows callStackRootFrames array detailsThe elements in the array are dictionaries, as follows cpuExceptionDiagnostics DetailsEach crash is a dictionary with the following contents: diagnosticMetaData dictionary detailscallStackTree dictionary detailscallStacks array detailsThe elements in the array are dictionaries, as follows callStackRootFrames array detailsThe elements in the array are dictionaries, as follows hangDiagnostics DetailsdiagnosticMetaData dictionary detailscallStackTree dictionary detailscallStacks array detailscallStackRootFrames array details |
<<: Let's talk about phantom types in Swift
>>: Apple discontinues iPod Touch, ending 20-year iPod legend
According to the poster, Python creator Guido van...
Winter in the north: witnessing the first snow vs...
Practitioners of online advertising in China all ...
In the past 2016, Samsung was in a quagmire. The ...
January 13 (Reporter Zhang Zhichang) Even without...
Background of Android FBE In this article, we wil...
How did Didi, Momo, and Meituan promote themselve...
With the vigorous development of mobile communica...
Blood oxygen saturation is a very important medic...
[[151069]] Large companies October 3: Google offi...
Why can’t our schools always produce outstanding ...
What is the happiest thing in a day? Of course it...
The sixth-generation iPod touch, which Apple just...
Perhaps due to the "crazy" price-perfor...
520 is here, and a great opportunity for young pe...