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
Smart micro projectors, to some extent, are a sub...
In 2016, competition in the mobile Internet arena...
There are many hot news in the air conditioning in...
Community is the most familiar word in user opera...
Chinanews.com, Dalian, July 23 (Reporter Yang Yi)...
Quest Mobile data shows that the scale of monthly...
Not long ago, Musk said that Tesla had achieved i...
Rumor: "White spots on the nails mean calciu...
Tencent Interactive Entertainment 's User Res...
The homepage of a website is extremely important ...
Products must be innovative, solve problems and r...
Reviewer of this article: Chen Haixu, Deputy Dire...
Optimizing an English site is much more difficult...
Fast Company's technology editor Harry McCrac...
Measuring blood pressure is a very important part...