This works in 10.3 but crashes in 10.2 In 10.2 you only see the messages from the first two NSLogs(non-IMP code)
#import <Foundation/Foundation.h>
int main (int argc, const char *argv[])
{
NSAutoreleasePool *pool;
NSDictionary *dictionary;
IMP imp;
pool = [[NSAutoreleasePool alloc] init];
dictionary = [NSDictionary dictionaryWithObject:@"VfL"
forKey:@"Bochum"];
NS_DURING
[dictionary selectorThatDoesNotExist];
NS_HANDLER
NSLog( @"Exception: %@", localException);
NS_ENDHANDLER
NSLog( @"Calling unimplemented messages via objc_msgSend can be caught");
NS_DURING
imp = [dictionary methodForSelector:@selector( selectorThatDoesNotExist)];
(*imp)( dictionary, @selector( selectorThatDoesNotExist));
NS_HANDLER
NSLog( @"Exception: %@", localException);
NS_ENDHANDLER
NSLog( @"And calling them via IMP can also be caught");
[pool release];
return( 0);
}