DEBUGビルドでのみ例外処理で落ちた時の詳細バグをConsoleに出力するためのコード群
通常リリースでもユーザーの環境での状態を出力して欲しければ、#ifdefは不要
Application.m
# ifdef DEBUG
static void uncaughtExceptionHandler(NSException *exception);
# endif
- (void) applicationDidFinishLaunching:(NSNotification *)notification
{
# ifdef DEBUG
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
# endif
}// end - (void) applicationDidFinishLaunching:(NSNotification *)notification
# ifdef DEBUG
static
void uncaughtExceptionHandler(NSException *exception)
{
NSLog(@"%@", exception.name);
NSLog(@"%@", exception.reason);
NSLog(@"%@", exception.callStackSymbols);
}
# endif