Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in setting up NSSetUncaughtExceptionHandler ..

I am facing some problems with setting up the uncaught exception handler. Here's what I am doing :

In the app delegate.h:

- (void) uncaughtExceptionHandler(NSException *exception);

In the app delegate.m:

void uncaughtExceptionHandler(NSException *exception) {
[FlurryAPI logError:@"Uncaught" message:@"Crash!" exception:exception];
}


- (void)applicationDidFinishLaunching:(UIApplication *)application { 
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);  // error line
[FlurryAPI startSession:@"API_KEY"];
    ....
}

I am getting the following error:

Use of Undeclared Identifier "uncaughtExceptionHandler"
like image 420
Ahsan Avatar asked Jun 22 '11 15:06

Ahsan


1 Answers

Try removing the leading "-" from the method declaration in the app delegate.h. This appears to be a lower-level, C-like function and not an Object-C object-oriented instance method (which is what "-" means in method declaration).

It should look like this:

void uncaughtExceptionHandler(NSException *exception);
like image 118
Patrick Perini Avatar answered Oct 20 '22 23:10

Patrick Perini