私はuncaughtExceptionHandler とGTMStackTraceでFlurryを使用しています
例外ハンドラは次のようになります。
void uncaughtExceptionHandler(NSException *exception)
{
@try
{
NSString *fullBacktrace = GTMSBStackTraceFromException(exception);
NSMutableString *backtrace = [NSMutableString stringWithUTF8String:""];
NSArray *backtraceArray = [fullBacktrace componentsSeparatedByString:@"\n"];
for (id entry in backtraceArray)
{
NSRange testRange = [entry rangeOfString:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]];
if (testRange.length)
{
[backtrace appendString:entry];
}
}
NSCharacterSet *whitespaces = [NSCharacterSet whitespaceCharacterSet];
NSPredicate *noEmptyStrings = [NSPredicate predicateWithFormat:@"SELF != ''"];
NSArray *parts = [backtrace componentsSeparatedByCharactersInSet:whitespaces];
NSArray *filteredArray = [parts filteredArrayUsingPredicate:noEmptyStrings];
NSString *strippedBacktrace = [filteredArray componentsJoinedByString:@" "];
[FlurryAnalytics logError:@"uncaughtExceptionHandler"
message:[NSString stringWithFormat:@"%@", strippedBacktrace ? strippedBacktrace : @"no matching backtrace"]
exception:exception];
}
@catch (NSException *exception)
{
NSLog(@"whoa! could not handle uncaught exception!");
[FlurryAnalytics logError:@"uncaughtExceptionHandler"
message:@"no matching backtrace"
exception:exception];
}
}
Testflightにも適切なクラッシュ ログがあります。