gpt4 book ai didi

ios - 是否有适用于 iPhone/iPad 生态系统的可靠崩溃报告系统?

转载 作者:可可西里 更新时间:2023-11-01 06:25:22 27 4
gpt4 key购买 nike

我知道在 Android 中,有一个非常可靠的内置系统可以在发生崩溃时通知我。他们几乎立即将堆栈跟踪和一些其他信息写入 Google 文档。它工作得非常好。

我开始为 ios 研究同样的东西,但我没有找到任何类似的东西同样有效。我读了这篇文章:Xcode storyboard: Why does the iPad storyboard show iPhone sized views?

但我不确定现在是否仍然如此。谁能推荐我使用什么来处理用户设备上发生的崩溃报告?

谢谢!

最佳答案

我正在使用 Flurry带有未捕获的异常处理程序和 GTMStackTrace

异常处理程序可以是这样的:

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也有一个很好的崩溃日志。

关于ios - 是否有适用于 iPhone/iPad 生态系统的可靠崩溃报告系统?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11989947/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com