Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crash Reporting in SWIFT iOS

Hello i am developing one ios application where i want to implement crashing reporting without using of any third party sdk or class i want to compose mail when my app will crash. I have implemented NSSetUncaughtExceptionHandler(exceptionHandlerPtr) into didFinishLaunchingWithOptions and added Objective-C Code for its handler Here Code of my CrashReporting.h file

volatile void exceptionHandler(NSException *exception);
extern NSUncaughtExceptionHandler *exceptionHandlerPtr;

and CrashReporting.m Code:

volatile void exceptionHandler(NSException *exception) {
    // Do stuff

    NSLog(@"App IS cCrAsSHsED %@",exception.description);
    NSLog(@"App IS cCrAsSHsED %@",exception.callStackSymbols);

   // Here i will Compose mail with error description and callStackSymbols.
}
NSUncaughtExceptionHandler *exceptionHandlerPtr = &exceptionHandler;

Its works fine but its not able to handle all type errors. how can i do same for Fatal Errors and Signal Errors into swift i have searched on Google but nothing found helpful for swift. Help will be Appreciate. Sorry for my bad english. Thanks.

like image 321
sohan vanani Avatar asked Dec 18 '15 11:12

sohan vanani


1 Answers

This is not necessary. It sounds to me that you just want to see the crash reports. Apple has already built the Crash Report Service which will usually (if users did not deactivate it) deliver you the crash reports so you can analyze them.

Therefore it is not necessary to reinvent the wheel.

like image 58
Raphael Avatar answered Nov 15 '22 01:11

Raphael