简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM