将自定义数据包含到 iOS 故障转储中

发布于 2024-12-20 21:02:55 字数 285 浏览 1 评论 0原文

你好堆栈溢出!

有一个简单的问题要问您:当我的应用程序在用户的设备上崩溃时,是否可以将自定义错误数据嵌入到自动生成的 iOS 故障转储中?

例如:我的 SQlite 数据库由于某种原因无法运行(例如,数据库文件已损坏)。我无法从这个错误中恢复,所以我抛出一个异常,并在异常中嵌入详细的 sqlite 错误消息。问题是,应用程序的故障转储不会包含异常消息,因此不容易知道应用程序在什么情况下崩溃。

有谁知道如何将内容放入故障转储报告中?或者您有其他推荐的方式向开发人员报告生产崩溃吗?

谢谢 !

Hello Stack Overflow !

A simple question for you : is it possible to embed custom error data into automatically generated iOS crash dumps I get from my users when my app crashed on their device ?

For example : My SQlite database won't operate for some reason (say, the database file is corrupted).. I cannot recover from this error, so I throw an exception, and embed in the exception the detailed sqlite error message. The problem is, the crash dump of the application won't contain the exception message, so it's not easy to know under which conditions the application crashed.

Does anyone know a way to put things into the crash dump report ? Or do you have any other recommended way of reporting production crashes to the developper ?

Thanks !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

顾铮苏瑾 2024-12-27 21:02:55

不可以,您不能将自己的数据添加到崩溃报告中。由于沙箱的原因,也不可能自动访问 iOS 生成的崩溃报告。

所以我的建议如下:

  1. 要记录自己的数据,请使用 Cocoalumberjack。它比 NSLog 或其他日志框架快得多,并且可以选择将消息记录到文件中。现在,当发生异常时,或者任何您想要的时候,将其记录到文件中。但是,如果您的应用程序在您向日志文件中添加某些内容时崩溃了,那么它很可能会丢失,因为应用程序在同一时刻崩溃了。

    因此,安全地捕获确切的 SQL 语句是相当不可能的。但是崩溃报告应该为您提供足够的信息来了解正在发生的情况,以及您之前记录的已完成的操作。例如,您可以在执行 SQL 之前记录 SQL 中使用的搜索字符串。

    一般来说,尽量不要记录太多。

  2. 要捕获崩溃报告,您应该使用基于开源框架的解决方案PLCrashReporter,可以 安全地捕获崩溃,即使您的应用程序已在应用程序商店中!不建议捕获异常,请查看这篇文章了解原因!

    iTunes Connect 还允许您查看一些崩溃报告,但需要长达 2 周的时间才能看到一些报告,但到目前为止,还没有像 Camera+ 开发人员。所以你最好使用自己的解决方案。

    PLCrashReporter 将向您发送标准 Apple 格式的崩溃报告,准备好进行符号化,以便您知道代码中发生崩溃的位置,包括行号。

    基于PLCrashReporter的一些解决方案是:

    • QuincyKit:开源客户端 + php 服务器,基本崩溃分组,符号化可以从你的 mac 自动化(我是的开发者)
    • HockeyApp:付费服务,使用 QuincyKit 客户端,高级崩溃分组,符号化完全在服务器上完成(我在这个的开发者)
    • Bugsense:免费服务,符号化宣布为高级功能
    • AppBlade:付费服务,符号未知
    • Crashlytics:私人测试版,未知功能,他们的解决方案似乎基于 PLCrashReporter
  3. 建议的解决方案要么允许在下次启动时自动发送数据,要么询问用户是否同意发送。

No, you cannot ad your own data into the crash reports. It is also not possible to access iOS generated crash reports automatically because of the sandbox.

So my suggestion is as follows:

  1. For logging your own data, use Cocoalumberjack. It is much faster than NSLog or other logging frameworks out there and has an option to log your messages into a file. Now when an exception occurs, or whenever else you want to, log that into a file. But if your app crashes right at a point where you add something into a log file, it most likely will be missing, since the app crashed the very same moment.

    So its rather impossible to safely catch the exact SQL statement. But the crash report should give you enough information to understand what is happening, with the addition to what you logged of being done before. E.g. you could log the search string used in the SQL way before the SQL is being executed.

    In general try not to log too much.

  2. For catching crash report you should nothing else than a solution based on the open source framework PLCrashReporter, which can safely catch crashes, also when you app is already in the app store! Exception catching is not recommended, check this article to see why!

    iTunes Connect offers you to view some crash reports too, but it takes up to 2 weeks to see some, but by far not all as e.g. pointed out by the Camera+ developers. So you better use your own solution.

    PLCrashReporter will send you standard apple formatted crash reports, ready for symbolication, so you know where the crash happens in your code, including line numbers.

    Some solutions based on PLCrashReporter are:

    • QuincyKit: Open Source client + php server, basic crash grouping, symbolication can be automated from your mac (I am the developer of this)
    • HockeyApp: Paid service, uses QuincyKit client, advanced crash grouping, symbolication fully done on the server (I am on of the developers of this)
    • Bugsense: Free service, symbolication announced as premium feature
    • AppBlade: Paid service, symbolication unknown
    • Crashlytics: Private beta, unknown features, their solution seems to be based on PLCrashReporter
  3. The proposed solutions either allow sending the data automatically on the next startup or by asking the user if he/she agrees to send.

攒一口袋星星 2024-12-27 21:02:55

常见问题免责声明:我是 AppBlade 的开发人员。

截至 2012 年 12 月,AppBlade 允许您发送自定义参数以及符号化崩溃报告。

查看一下! http://blog.appblade.com/新闻/2012/12/appblade-sdk-update-sessions-and-queues/

Disclaimer-as-per-the-faq: I am a developer for AppBlade.

AppBlade allows you to send custom parameters along with symbolicated crash reports as of December 2012.

Check it out! http://blog.appblade.com/news/2012/12/appblade-sdk-update-sessions-and-queues/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文