崩溃日志没有崩溃?

发布于 12-04 19:11 字数 158 浏览 4 评论 0原文

嘿,这可能是一个愚蠢的问题,但我在任何地方都找不到答案,如果很容易找到答案并且我的研究技能很差,我深表歉意。

无论如何,当应用程序不崩溃时是否可以生成崩溃报告?那么如果用户遇到错误,是否可以选择允许他们生成崩溃报告,然后将其发送给我?另外我该怎么做呢?

感谢您的帮助:)

Hey this may be a stupid question but I couldn't find the answer anywhere, apologies if the answer is easily found and if my research skills are pants.

anyway is it possible to generate a crash report when an app doesn't crash? so say if a user encounters a bug could there be an option to allow them to generate a crash report which can then be sent to me? also how would I go about doing this?

Thanks for any help :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

鱼窥荷2024-12-11 19:11:11

这是我用于堆栈跟踪的内容:

        NSArray *callStackArray = [exception callStackReturnAddresses];
        int frameCount = [callStackArray count];
        void *backtraceFrames[frameCount];

        for (int i=0; i < frameCount; i++) {
            backtraceFrames[i] = (void *)[[callStackArray objectAtIndex:i] unsignedIntegerValue];
        }

        char **strs = backtrace_symbols(backtraceFrames, frameCount);

        NSMutableArray *backtraceArray = [NSMutableArray arrayWithCapacity:frameCount];
        for (int i = 0; i < frameCount; i++) {
            NSString *entry = [NSString stringWithUTF8String:strs[i]];
            [backtraceArray addObject:entry];
        }
        free(strs);

您只需确保不会对您的应用程序造成任何损害:http://landonf.bikemonkey.org/2011/09/14。您还可以使用 PLCrashReporter 来处理所有崩溃,或者如果您像我一样懒,请使用类似 Crittercism 的服务

Here's what I use for my stacktraces:

        NSArray *callStackArray = [exception callStackReturnAddresses];
        int frameCount = [callStackArray count];
        void *backtraceFrames[frameCount];

        for (int i=0; i < frameCount; i++) {
            backtraceFrames[i] = (void *)[[callStackArray objectAtIndex:i] unsignedIntegerValue];
        }

        char **strs = backtrace_symbols(backtraceFrames, frameCount);

        NSMutableArray *backtraceArray = [NSMutableArray arrayWithCapacity:frameCount];
        for (int i = 0; i < frameCount; i++) {
            NSString *entry = [NSString stringWithUTF8String:strs[i]];
            [backtraceArray addObject:entry];
        }
        free(strs);

You just have to make sure you don't do any harm to your app: http://landonf.bikemonkey.org/2011/09/14. You could also use PLCrashReporter to handle all your crashes or if you're lazy like me, use a service like Crittercism

嘦怹2024-12-11 19:11:11

我曾经也使用 backtrace_symbols 来处理崩溃,但后来我发现它可能很危险,因为该方法不是异步安全的。从那以后,我研究了一堆崩溃报告解决方案,并为我的应用程序选择了 Crittercism,它非常好用!

I used to use backtrace_symbols for handling my crashes too, but then I found out that it could be dangerous since the method is not async-safe. I've since looked at a bunch of crash reporting solutions and went with Crittercism for my apps and it's been pretty sweet!

云胡2024-12-11 19:11:11

我建议您查看几天前发布的TestFlight SDK。它具有一些很棒的功能,例如远程日志记录,甚至实时崩溃报告。

I suggest you check out TestFlight SDK released a few days ago. It has some awesome features like remote logging and even live crash reports.

知足的幸福2024-12-11 19:11:11

对于临时版本,您可以只调用函数 abort(),或抛出某种类型的异常。

如果 App Store 版本在测试期间完全崩溃,则不允许发布。

For an ad hoc version, you could just call the function abort(), or throw and exception of some kind.

An App Store version will not be allowed to ship if it crashes at all during testing.

可是我不能没有你2024-12-11 19:11:10

当我不得不打印堆栈跟踪时,我已经使用过它几次:

+ (NSArray *)backtrace
{
    void* callstack[128];
    int frames = backtrace(callstack, 128);
    char **strs = backtrace_symbols(callstack, frames);

    int i;
    NSMutableArray *backtrace = [NSMutableArray arrayWithCapacity:frames];
    for (
        i = UncaughtExceptionHandlerSkipAddressCount;
        i < UncaughtExceptionHandlerSkipAddressCount +
            UncaughtExceptionHandlerReportAddressCount;
        i++)
    {
        [backtrace addObject:[NSString stringWithUTF8String:strs[i]]];
    }
    free(strs);

    return backtrace;
} 

“当应用程序在 iPhone 上崩溃时,它会消失而不告诉用户发生了什么。但是,可以向应用程序添加异常和信号处理,以便可以向用户显示错误消息,或者您可以保存更改,甚至可以尝试从这种情况中恢复而不会崩溃。”
看看 http://cocoawithlove.com/2010/05/handling-unhandled -例外-and.html

I have used it couple of times when I had to print stack trace:

+ (NSArray *)backtrace
{
    void* callstack[128];
    int frames = backtrace(callstack, 128);
    char **strs = backtrace_symbols(callstack, frames);

    int i;
    NSMutableArray *backtrace = [NSMutableArray arrayWithCapacity:frames];
    for (
        i = UncaughtExceptionHandlerSkipAddressCount;
        i < UncaughtExceptionHandlerSkipAddressCount +
            UncaughtExceptionHandlerReportAddressCount;
        i++)
    {
        [backtrace addObject:[NSString stringWithUTF8String:strs[i]]];
    }
    free(strs);

    return backtrace;
} 

"When an application crashes on the iPhone, it disappears without telling the user what happened. However, it is possible to add exception and signal handling to your applications so that an error message can be displayed to the user or you can save changes. It is even possible to try to recover from this situation without crashing at all."
Look at http://cocoawithlove.com/2010/05/handling-unhandled-exceptions-and.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文