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
Liu Heng's "Passing Yin Yang Golden Lock...
If you want to increase the traffic of your Xiaoh...
Today, Strawberry would like to talk to you about...
This article provides a brief analysis of Xiaohon...
When it comes to CPUs, GPUs, and TPUs, we are usu...
Feng Zhulong teaches you how to learn PS from scr...
Audit expert: Zhan Mingjin PhD, Chinese Academy o...
When operating a Tik Tok account, what you look f...
gossip "For every bunch of bananas picked, a...
Everyone knows the simple principle of weight los...
1. Please accept this marketing trick! Frederick ...
The complete collection of Jin Yong's martial...
On December 24, Minister of Industry and Informat...
In 2011, the domestic smartphone market ushered i...
In the traditional centralized e-commerce model, ...