static void UncaughtExceptionHandler(NSException *exception) {
NSLog(@"Uncaught exception: %@: %@\n%@", [exception name], [exception reason], [exception callStackSymbols]);
if (gsCrashReporterUEHandler)
gsCrashReporterUEHandler(exception);
}
static void InitObjCUEHandler()
{
// Crash reporter sets its own handler, so we have to save it and call it manually
gsCrashReporterUEHandler = NSGetUncaughtExceptionHandler();
NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler);
}
void InitCrashHandling()
{
#if ENABLE_CUSTOM_CRASH_REPORTER
InitCrashReporter();
#endif
#if ENABLE_OBJC_UNCAUGHT_EXCEPTION_HANDLER
InitObjCUEHandler();
#endif
}
// This function will be called when AppDomain.CurrentDomain.UnhandledException event is triggered.
// When running on device the app will do a hard crash and it will generate a crash log.
void CrashedCheckBellowForHintsWhy()
{
#if ENABLE_CRASH_REPORT_SUBMISSION
// Wait if app has crashed before we were able to submit an older pending crash report. This
// could happen if app crashes at startup.
WaitWhileCrashReportsAreSent();
#endif
#if ENABLE_IOS_CRASH_REPORTING || ENABLE_CUSTOM_CRASH_REPORTER
// Make app crash hard here
__builtin_trap();
// Just in case above doesn't work
abort();
#endif
}
Above is a piece of code from my crashreporter.mm
#define ENABLE_IOS_CRASH_REPORTING 1
#define ENABLE_OBJC_UNCAUGHT_EXCEPTION_HANDLER 1
#define ENABLE_CUSTOM_CRASH_REPORTER 1
#define ENABLE_CRASH_REPORT_SUBMISSION 0
#if ENABLE_CRASH_REPORT_SUBMISSION && !ENABLE_CUSTOM_CRASH_REPORTER
#undef ENABLE_CUSTOM_CRASH_REPORTER
#define ENABLE_CUSTOM_CRASH_REPORTER 1
#endif
Above is whats on my crashreporter.h
Player Settings -> Script Optimization = Fast but no exception
I'm using Unity Pro
When i force a crash on unity and check my CrashReport.reports on unity i dont get any report.
i also put a breakpoint on xcode crashreporter.mm -> UncaughtExceptionHandler (), it doesn't go there whenever there is a crash.
crashreporter.mm -> CrashedCheckBellowForHintsWhy () is the only function called inside crashreporter.mm when a crash happens.
Please help me on how i could make crash reporter work. I've done various work around to get my game's unhandled exception info but nothing works unless i set script optimization to Slow but safe and use Application.RegisterLogCallBack instead but that would mean sacrificing performance.
↧