PLCrashReporterアップロードクラッシュログ、symbolicatecrashログ分析を使用する



Use Plcrashreporter Upload Crash Logs



統合されたPLCrashReporterアップロードログ

PLCrashReporterはオープンソースであり、公式Webサイトのアドレスは次のとおりです。 https://www.plcrashreporter.org/

プロジェクトに統合されて導入されたCrashReporter.framework、



implementation AppDelegate -(void)handleCrashReport { PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter] NSData *crashData NSError *error crashData = [crashReporter loadPendingCrashReportDataAndReturnError:&error] if (crashData == nil) { NSLog(@'Could not load crash report: %@', error) [crashReporter purgePendingCrashReport] return } / * CrashData can be uploaded directly to the server, the following code is saved to the Document * / NSArray *docPathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) NSString *docPath = [docPathArray firstObject] NSString *path = [docPath stringByAppendingString:@'/crashdata.crash'] [crashData writeToFile:path atomically:YES] PLCrashReport *report = [[PLCrashReport alloc] initWithData:crashData error:&error] if (report == nil) { NSLog(@'Could not parse crash report: %@', error) [crashReporter purgePendingCrashReport] return } / * CrashData need to use PLCrashReporter tools crashutil resolution, can also be saved directly to a string * / NSString *humanReadable = [PLCrashReportTextFormatter stringValueForCrashReport:report withTextFormat:PLCrashReportTextFormatiOS] NSLog(@'Report: %@', humanReadable) } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter] NSError *error if ([crashReporter hasPendingCrashReport]) { [self handleCrashReport] } if (![crashReporter enableCrashReporterAndReturnError:&error]) { NSLog(@'Warning: Could not enable crash reporter: %@', error) } }

PLCrashReporterによってcrashDataに収集され、次のようにターミナルコマンドで通常の.crashファイルPLCrashReporterツールに変換されます(現在のフォルダーにcdされている場合でも、。/を取る必要があります)。

./plcrashutil convert --format=iphone example_report.plcrash > app.crash

直接使用できます[PLCrashReportTextFormatter stringValueForCrashReport:report withTextFormat:PLCrashReportTextFormatiOS]結果の文字列.crashファイルを保存します。



symbolicatecrash分析

.crashログを取得したら、分析して、どのファイルがどのファイルであるかを特定のコード行に移動する必要があります。symbolicatecrashを使用できます。チュートリアルは次のとおりです。 symbolicatecrash分析の.crashファイルを使用する

export DEVELOPER_DIR = '/ Applications / Xcode.app / Contents / Developer'

./symbolicatecrash report.crash AppName.app.dSYM> 1001.crash