将自定义数据包含在iOS崩溃转储中 [英] Including custom data into iOS crash dumps

查看:93
本文介绍了将自定义数据包含在iOS崩溃转储中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Stack Overflow!



一个简单的问题:是否可以将自定义错误数据嵌入到我的应用程序中从我的用户那里得到的自动生成的iOS崩溃转储在他们的设备上崩溃?



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



有没有人知道将事情放入崩溃转储报告的方式?或者您是否还有其他建议的方式向开发人员报告生产崩溃?



谢谢!

解决方案

不,您无法将自己的数据广告到崩溃报告中。因为沙箱,也无法自动访问iOS生成的崩溃报告。



所以我的建议如下:


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



    所以它相当不可能安全地捕获确切的SQL语句。但是崩溃报告应该给你足够的信息来了解发生了什么,除了你以前做过的记录。例如。您可以在SQL执行之前记录以SQL方式使用的搜索字符串。



    一般来说,请勿记录太多。


  2. 为了捕捉崩溃报告,您应该只是基于开源框架的解决方案 PLCrashReporter ,它可以安全捕获崩溃,也是当你的应用程序已经在应用商店!不建议使用异常捕获,请查看这篇文章了解原因! p>

    iTunes Connect还可以查看一些崩溃报告,但最多需要2个星期才能看到一些,但到目前为止,并不是所有的例如由 Camera +开发人员指出。所以您最好使用自己的解决方案。



    PLCrashReporter将向您发送标准的苹果格式的崩溃报告,准备好符号,以便您知道代码中的崩溃发生在哪里,包括线路数字。



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




    • QuincyKit :开源客户端+ php服务器,基本的崩溃分组,符号可以从你的mac自动化(我是这个的开发者)

    • HockeyApp :付费服务,使用QuincyKit客户端,高级崩溃分组,在服务器上完成的符号(我是这个开发者)

    • Bugsense :免费服务,象征宣布为高级功能

    • AppBlade :付费服务,符号未知

    • Crashlytics :私有测试版,未知功能,他们的解决方案似乎是基于PLCrashReporter


  3. 提出的解决方案可以允许在下次启动时自动发送数据,也可以通过询问用户是否同意发送。



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 !

解决方案

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.

这篇关于将自定义数据包含在iOS崩溃转储中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆