6

クラッシュ データを取得した後、クラッシュ レポートを象徴する方法はありますか?

現在、これは私が handleCrashReport メソッドで行っていることです。

PLCrashReportTextFormat textFormat = PLCrashReportTextFormatiOS;

    /* Decode data */

    PLCrashReport *crashLog = [[PLCrashReport alloc] initWithData: data error: &error];
    if (crashLog == nil) {
        NSLog(@"Could not decode crash file :%@",  [[error localizedDescription] UTF8String]);
    } else {
        NSString* report = [PLCrashReportTextFormatter stringValueForCrashReport: crashLog withTextFormat: textFormat];
        NSLog(@"Crash log \n\n\n%@ \n\n\n", report);

        NSString *outputPath = [documentsDirectory stringByAppendingPathComponent: @"app.crash"];
        if (![report writeToFile:outputPath atomically:YES encoding:NSUTF8StringEncoding error:nil]) {
            NSLog(@"Failed to write crash report");
        } else {
            NSLog(@"Saved crash report to: %@", outputPath);
        }

    }

これをコンソールに出力すると; 私はこれを取得します。

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This should crash the application.'

Thread 0 Crashed:
0   libsystem_kernel.dylib              0x93a0d9c6 0x939f5000 + 100806
1   libsystem_c.dylib                   0x9c5aabdd 0x9c55b000 + 326621
2   shell                               0x00082a2c 0x1000 + 530988
3   CoreFoundation                      0x0263d0fc 0x253f000 + 1040636
4   libobjc.A.dylib                     0x00f8ef0f 0xf89000 + 24335
5   libc++abi.dylib                     0x02a028de 0x29fd000 + 22750
6   libc++abi.dylib                     0x02a02946 0x29fd000 + 22854
7   libc++abi.dylib                     0x02a03b3e 0x29fd000 + 27454
8   libobjc.A.dylib                     0x00f8ee15 0xf89000 + 24085
9   CoreFoundation                      0x02573de0 0x253f000 + 216544
10  CoreFoundation                      0x02573c9b 0x253f000 + 216219
11  UIKit                               0x0150ac65 0x1501000 + 40037
12  UIKit                               0x0150c626 0x1501000 + 46630
13  shell                               0x00002fed 0x1000 + 8173
14  shell                               0x00001f95 0x1000 + 3989

Thread 1:
0   libsystem_kernel.dylib              0x93a0e90a 0x939f5000 + 104714
1   libdispatch.dylib                   0x02ad2be1 0x2ad1000 + 7137

Thread 2:
0   libsystem_kernel.dylib              0x93a0bc22 0x939f5000 + 93218
1   libsystem_notify.dylib              0x97cb9cd2 0x97cb8000 + 7378
2   libsystem_notify.dylib              0x97cbdb4b 0x97cb8000 + 23371
3   libsystem_c.dylib                   0x9c5e859b 0x9c55b000 + 578971
4   CoreFoundation                      0x025e61c3 0x253f000 + 684483
5   CoreFoundation                      0x025e5d83 0x253f000 + 683395
6   Foundation                          0x00caab53 0xc34000 + 486227
7   Foundation                          0x00caaac5 0xc34000 + 486085
8   shell                               0x003ddbf8 0x1000 + 4049912
9   libdispatch.dylib                   0x02ad2330 0x2ad1000 + 4912
10  libdispatch.dylib                   0x02ad3f0c 0x2ad1000 + 12044
11  libdispatch.dylib                   0x02ad3cb4 0x2ad1000 + 11444
12  libdispatch.dylib                   0x02ad3402 0x2ad1000 + 9218
13  libsystem_c.dylib                   0x9c5b9b24 0x9c55b000 + 387876
14  libsystem_c.dylib                   0x9c5bb6fe 0x9c55b000 + 395006

出来ればインプロセスを象徴したい。何か案は?

よろしくお願いします。

4

2 に答える 2

3

進行中のクラッシュ レポートをシンボル化できます。これには次の 3 つのことが必要です。

  1. 次のアプリの起動時にのみそれを行う必要があります。
  2. アプリのシンボルをバイナリの一部にする必要があるため、サイズが 30 ~ 50% 増加します。
  3. 行番号は取得できません。

PLCrashReporter の最新バージョンはそれを行うことができますが、私はそれをお勧めしません。むしろ、dSYM を使用してシンボル化する方がはるかに便利です。

于 2012-11-11T14:39:05.897 に答える
2

PLCrashReporter は、デバイス上でシンボル化する構成オプションを提供します

  PLCrashReporterConfig *config = [[PLCrashReporterConfig alloc] initWithSignalHandlerType: PLCrashReporterSignalHandlerTypeBSD symbolicationStrategy: PLCrashReporterSymbolicationStrategyAll];
PLCrashReporter *crashReporter = [[PLCrashReporter alloc] initWithConfiguration:config];

ただし、DSYM によるシンボリック化が優れている理由が 2 つあります。

  • ドキュメントでは、リリース バージョンではこの機能を使用しないことを推奨しています。
  • シンボル化は、DSYM およびシステム フレームワークのデバッグ シンボルを使用するものほど良くありません。多くの '' 行が表示されます。

開発マシンでクラッシュ レポートをシンボル化するには、次のようにします (元のバイナリと dsym ファイルが同じディレクトリにあり、クラッシュ レポートに記載されている iOS バージョンのデバッグ シンボルがあることを確認してください)。

/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash MyCrash.crash
于 2014-10-29T11:36:24.203 に答える