- Home /
Crash Reporter for IOS not working.
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.
Answer by TamaHobbit · Jan 15, 2016 at 05:45 PM
Did you check what's in Player settings under iOS for "Debugging and crash reporting"? There's a little documentation about what that does here, but it seems that the old way of subscribing to Application.logMessageReceived to handle C# exceptions is broken on iOS as of Unity 5 - The release notes say "New bugreporter", so you'll have to learn how to use that, it seems.
Your answer
Follow this Question
Related Questions
Crash report xcode organizer symbol 1 Answer
App Store Rejection - Crashes 2 Answers
Unity 4.2 IOS Exception Handling 0 Answers
iOS game freezes on startup 0 Answers