iOS崩溃只有当没有通过XCode运行。沉默? [英] iOS crash only when NOT running via XCode. Concidence?

查看:205
本文介绍了iOS崩溃只有当没有通过XCode运行。沉默?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程式仅在未使用XCode侦错程式执行时才会崩溃。这是很难跟踪,因为我不能调试,但我终于弄清楚了。这是因为调用释放一些不是我拥有的对象。在我更正之前,我搜索并发现了2个相关问题(下面的链接)

My app was crashing only when not running using XCode debugger. It was hard to track because I can't debug but I finally figured it out. It was because of calling release on some object not owned by me. Before I corrected it I searched and found 2 related questions here (links below)

iOS App当在设备上运行时崩溃,当使用调试器运行Xcode时不会崩溃,在模拟器

iPhone崩溃,只有当设备未连接到xcode,如何理解崩溃日志吗?

上面的问题都没有回答为什么没有崩溃时通过调试器运行。我的问题是为什么会发生?我知道调试/释放特定崩溃的原因,但这是疯了。它只是偶然,虽然它发生了10次以上。

None of the above question has answered why no crash when running via debugger.So my question is why it happens ? I know reasons for debug/release specific crashes but this is crazy. Is it just by chance although it happened more than 10 times.

推荐答案

您描述的内容不是非典型的内存相关错误。你可能还想在这样的时候使用debug-malloc。虽然这不能保证找到一切。原因(并且它可能只要有源代码级调试器发生)是,内存至少在可调试代码中和在调试器下运行时有些不同。因此,在调试器下,错误导致不同的内存块(无害地)损坏。当不在调试器下时,位置被损坏实际上是你的代码关心的东西,它崩溃了。

What you describe is not atypical of obscure memory-related bugs. You might also want to use debug-malloc at such times. Although that is not guaranteed to find everything. The reason (and it's been happening probably as long as there've been source-level debuggers) is that memory is laid out at least somewhat differently in debuggable code, and when running under the debugger. So the error results in a different piece of memory being (harmlessly) corrupted when under the debugger. When not under the debugger the location corrupted is actually something that your code cares about, and it crashes.

同样的情况可能发生相反,但你永远不会知道 - 如果在运行debuggable时崩溃,你会在切换到在调试环境外运行之前找到它。

The same could happen in reverse, but you'd never know - if it crashes when run debuggable, you'd find it before switching to running outside the debugging environment.

这篇关于iOS崩溃只有当没有通过XCode运行。沉默?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆