• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Crashing on all relevant exceptions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crashing on all relevant exceptions


  • Subject: Re: Crashing on all relevant exceptions
  • From: Aaron Jacobs <email@hidden>
  • Date: Mon, 7 Aug 2006 20:56:26 -0700

This will print a bunch of memory locations in hexadecimal and then continue the program, which is not exactly ideal and is not even close to what my request for help continues to be.

If you read the thread you will see that lot of that code is unnecessary as the same can be accomplished by simply overriding -run in NSApplication. Moreover, your RTFM quip is also unnecessary, as I mentioned basically the exact same solution of printing a stack trace (human-readable, no less) on the list an hour ago.

Thanks for the help, but next time please read my request more closely if you're going to be hostile about it.


#include <RTFM>
#import <Cocoa/Cocoa.h>
#import <ExceptionHandling/NSExceptionHandler.h>

static void MyUncaughtExceptionHandler(NSException *exception)
{
NSLog(@"*** Uncaught exception: %@ %@ [%@]\n", [exception name], [exception reason],
[[exception userInfo] objectForKey:NSStackTraceKey]);
}


int main(int argc, char *argv[])
{
NSSetUncaughtExceptionHandler(MyUncaughtExceptionHandler);

[[NSExceptionHandler defaultExceptionHandler] setExceptionHandlingMask:
NSHandleUncaughtExceptionMask |
NSHandleUncaughtSystemExceptionMask |
NSHandleUncaughtRuntimeErrorMask |
NSHandleTopLevelExceptionMask |
NSHandleOtherExceptionMask];

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
Class appClass = NSClassFromString([infoDict objectForKey:@"NSPrincipalClass"]);
[NSBundle loadNibNamed:[infoDict objectForKey:@"NSMainNibFile"] owner:[appClass sharedApplication]];
[NSApp finishLaunching];
[pool release];

do {
@try {
[NSApp run];
}
@catch (NSException *exception) {
MyUncaughtExceptionHandler(exception);
}
} while ([NSApp isRunning]);

return 0;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Crashing on all relevant exceptions
      • From: Shaun Wexler <email@hidden>
References: 
 >Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Nick Zitzmann <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Nick Zitzmann <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Shaun Wexler <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Nick Zitzmann <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Shaun Wexler <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Shaun Wexler <email@hidden>)

  • Prev by Date: Re: Crashing on all relevant exceptions
  • Next by Date: Removing particular undo/redo actions with Core Data
  • Previous by thread: Re: Crashing on all relevant exceptions
  • Next by thread: Re: Crashing on all relevant exceptions
  • Index(es):
    • Date
    • Thread