Application detection broke during load / last time it was run?

综合技术 2018-02-16

I would like for my app to reset to standard settings if it crashed during startup. Preferably also if it crashed last time it was run.

EDIT: Crittercism has a crittercismDidCrashOnLastLoad method, but it only handles the case of crashing during load. It didn't work properly in the version of the library I used, but this has since been fixed.


Make 2 functions in your AppDelegate.m

void HandleException(NSException *exception) {
    NSLog(@"App crashing with exception: %@", exception);
    //Save somewhere that your app has crashed.

void HandleSignal(int signal) {
    NSLog(@"We received a signal: %d", signal);
    //Save somewhere that your app has crashed.

Then in your -(BOOL)application:didFinishLaunchingWithOptions
before anything else put:


struct sigaction signalAction;
memset(&signalAction, 0, sizeof(signalAction));
signalAction.sa_handler = &HandleSignal;

sigaction(SIGABRT, &signalAction, NULL);
sigaction(SIGILL, &signalAction, NULL);
sigaction(SIGBUS, &signalAction, NULL);


Exception by calling another screen in IOS I am new in IOS developing. In Main.storyoard , I added a new viewcontroller , assigned it to a new class("LoginViewController") and provided a...
Blocks of code with Grand Central Dispatch I'm writing an app using ARC, and I'm wondering if the following will cause a problem. Specifically, I'm creating an object 'A', then using GCD I add ...
Nothing happens when you press the Google Sign In ... i have configuered Google SDK for ios using pods.and i have added a uiview to work as Sign in button (set the class to GIDSignInButton). and added the...
What is the meaning of WaitUntilDOne in performSel... What is the significance of WaitUntilDOne in performSelectorOnMainThread ? IN what way the YES or NO set to WaitUntilDone can ...
NSView NSImage NSData转换 NSBitmapImageRep *bitmap = ]; toBitmapImageRep:bitmap];NSImage *image = initWithSize:NSMakeSize(width, height)]; ;NSBitmapImageRep *bitma...