我在AppDelegate.m中使用以下代码片段来捕获异常:
void uncaughtExceptionHandler(NSException *exception)
{
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
}我怎样才能避免这个警告:
Semantic Issue: No previous prototype for function 'uncaughtExceptionHandler'?
发布于 2013-10-23 14:40:37
只需在.h文件中声明此方法
void uncaughtExceptionHandler(NSException * exception);
或将此函数置于调用函数之上。
void uncaughtExceptionHandler(NSException *exception){
//your code
}
-
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSSetUncaughtExceptionHandler(&HandleExceptions);
//your code
return YES;
}https://stackoverflow.com/questions/19544334
复制相似问题