【问题标题】:How to add PLCrashReporter in my app?如何在我的应用程序中添加 PLCrashReporter?
【发布时间】:2012-12-11 07:17:16
【问题描述】:

我想实现应用内崩溃日志的创建,并在应用崩溃后从用户那里获取。所以,我查看了 PLCrashReport 并尝试添加到我的应用程序中。我发现有很多链接可以下载这个框架。喜欢Google codeGithub

我真的不知道我应该下载哪个文件。它显示了某种二进制发布、源代码发布、大量 PLCrashReporters..

有人可以指出在我的应用中添加 PLCrashReporter 的方法吗?

提前致谢

【问题讨论】:

  • 在 GH 上找到您喜欢的活动存储库,单击“在 Mac 中克隆”或 Zip。简单的。所有的道路都指向利润。
  • 这里的问题是找到原始的PLCrashReport。它显示了很多不同大小的PLCrashReporter。 :(
  • 这取决于您的个人喜好。如果您想要最前沿的组件或第一方组件,请下载 Google 代码,否则,只需选择一个 GitHub 存储库并下载那个傻瓜。它们都是 PLCrashReporter,只是处于不同的开发阶段。
  • 感谢您提供的信息。您能否分享任何提供有关 PLCrashReporter 设置信息的链接?
  • 将解压后的zipball目录移动到你的项目目录中,然后将它的Xcode项目添加为子项目,并链接到框架。谷歌此评论中的任何术语,应该会出现适合子项目框架的教程。

标签: ios crash plcrashreporter


【解决方案1】:

显示了如何集成 PLCrashReporter 的示例here (archived)

//
// Called to handle a pending crash report.
//
- (void) handleCrashReport {
    PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter];
    NSData *crashData;
    NSError *error;
    // Try loading the crash report
    crashData = [crashReporter loadPendingCrashReportDataAndReturnError: &error];
    if (crashData == nil) {
        NSLog(@"Could not load crash report: %@", error);
        goto finish;
    }
    // We could send the report from here, but we'll just print out
    // some debugging info instead
    PLCrashReport *report = [[[PLCrashReport alloc] initWithData: crashData error: &error] autorelease];
    if (report == nil) {
        NSLog(@"Could not parse crash report");
        goto finish;
    }
    NSLog(@"Crashed on %@", report.systemInfo.timestamp);
    NSLog(@"Crashed with signal %@ (code %@, address=0x%" PRIx64 ")", report.signalInfo.name,
          report.signalInfo.code, report.signalInfo.address);
    // Purge the report
finish:
    [crashReporter purgePendingCrashReport];
    return;
}
// from UIApplicationDelegate protocol
- (void) applicationDidFinishLaunching: (UIApplication *) application {
    PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter];
    NSError *error;
    // Check if we previously crashed
    if ([crashReporter hasPendingCrashReport])
        [self handleCrashReport];
    // Enable the Crash Reporter
    if (![crashReporter enableCrashReporterAndReturnError: &error])
        NSLog(@"Warning: Could not enable crash reporter: %@", error);
}

【讨论】:

  • 请问有 mac os x 的例子吗?关于如何在基于 cocoa 的应用程序中使用框架?
  • 需要定义哪些头文件?
  • 有头文件需要导入吗?我已经在我的项目中添加了框架。但是一旦我粘贴崩溃代码,它就会显示“使用未声明的标识符'PLCrashReporter'”。请帮忙..
  • 知道了。在这里找到标题:stackoverflow.com/questions/20540273/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多