Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

iphone - how to generate crash report using code like crash report provided by Apple

i want to generate crash report for Symbolicate iOS Crash to View Crash Logs,so i want to get the crash report using code,at present i only get :

* -[__NSArrayM objectAtIndex:]: index 121 beyond bounds [0 .. 23]

 Application received signal SIGSEGV

( 

  0   CoreFoundation                      0x3120e2bb  + 186
  1   libobjc.A.dylib                     0x38f2b97f objc_exception_throw + 30
  2   CoreFoundation                      0x3120e1c5  + 0
  3   myshine                             0x001f9f51 myshine + 1503057
  4   libsystem_c.dylib                   0x393a9e8b _sigtramp + 34
  5   myshine                             0x000ac985 myshine + 137605
  6   myshine                             0x000ac35d myshine + 136029
  7   CoreFoundation                      0x311ab7cf  + 74

)

 not have 

/ 1: Process Information
  Incident Identifier: 30E46451-53FD-4965-896A-457FC11AD05F
  CrashReporter Key:   5a56599d836c4f867f6eec76afee451bf9ae5f31
  Hardware Model:      iPhone4,1
  Process:         Rage Masters [4155]
  Path:            /var/mobile/Applications/A5635B22-F5EF-4CEB-94B6-FE158D885014/Rage      Masters.app/Rage Masters
  Identifier:      Rage Masters
  Version:         ??? (???)
  Code Type:       ARM (Native)
  Parent Process:  launchd [1]

 / / 2: Basic Information
Date/Time:       2012-10-17 21:39:06.967 -0400
OS Version:      iOS 6.0 (10A403)
Report Version:  104

// 3: Exception
Exception Type:  00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread:  0

i want to get the same report

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

So you want to write your own crash reporter so you can get the reports and symbolicate them?

Writing crash reports is very very hard, see these two articles from the developer of the Open Source library PLCrashReporter to get an idea what is involved: http://landonf.bikemonkey.org/code/objc/Reliable_Crash_Reporting.20110912.html and http://landonf.bikemonkey.org/code/crashreporting/Reliable_Crash_Reporting_1.1.20130119.html

In short:

  • All code must be async-safe. That means you can NOT use any Objective-C code. Most of the C methods are also not async safe.
  • You can (basically) not allocate new memory once a crash occurred.

All the details you are asking and the ones that are not yet asked to write such a reporter would require to write way more than could fit in an answer.

Just don't write it yourself and safe yourself some trouble. There are plenty of ready to use solutions out there. Some are Open Source and can be validated if they are safe to the above rules, some are closed source and cannot be easily validated (The articles above do go into details for some of them).

I will not make any recommendation on the various solutions, since I am biased as I am a developer of one Open Source and one commercial solution. The articles linked above do analyze some of the available solutions.

So here are some.

Open Source:

  • PLCrashReporter: Uses in thousands of apps since 2009. Safe, reliably, creates standard format crash reports that can be symbolicated.
  • KSCrash: Pretty new. Creates standard format crash reports. Can connect to different server solutions.
  • QuincyKit: Client SDK and PHP based server component based on PLCrashReporter. Makes integrating PLCrashReporter easy and server component collects reports and groups them once they are symbolicated. Symbolication can be automated using your own Mac to do the actual symbolication. (Disclaimer: I am the developer of this)

Hosted/Commercial Solutions:

  • Bugsense: Free and paid plans. Uses PLCrashReporter under the hood. Rest of the SDK seems to be closed source. Server side symbolication.
  • BugSnag: Free and paid plans. Open Source SDK. Uses KSCrash under the hood.
  • Crashlytics: Free. Closed source. Did use PLCrashReporter under the hood, now use their own implementation. Server side symbolication.
  • Crittercism: Free and paid plans. Uses PLCrashReporter under the hood. Rest of the SDK seems to be closed source. Server side symbolication.
  • HockeyApp: Paid plans, 1 month trial. Uses PLCrashReporter under the hood, all SDKs open source. Creates standard format crash reports. Server side symbolication. (Disclaimer: I am one of the Co-Founders and developers of this)
  • Sentry: Paid, Pretty new, Open Source (SDK and Server). Uses KSCrash under the hood.
  • Testflight: Free, closed source. Server side symbolication.

There surely are some more out there which I forgot about.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...