iPhone 应用程序仅在 3G 上的发布模式下崩溃 [英] iPhone app crashes only in Release mode on 3G
问题描述
我正在编写的一个应用程序在我使用EXC_BAD_ACCESS"在 UIScrollView 上调用 addSubview 时崩溃.它仅在 iPhone 3G 发布模式下且仅在设备上执行此操作.我在所有其他配置中都能正常工作:
I have an app I'm writing that crashes when I call addSubview on a UIScrollView with "EXC_BAD_ACCESS". It only does this on iPhone 3G in release mode and only on the device. I works fine in all these other configurations:
iPhone 3G - 调试模式iPhone 3GS - 调试和发布模式iPhone 4 - 调试和发布模式模拟器 - 全部.
iPhone 3G - Debug mode iPhone 3GS - Debug AND Release Mode iPhone 4 - Debug AND Release Mode Simulator - all.
此外,没有合理的理由会发生这种情况.我的任何代码都没有释放我的对象.
Furthermore, there is no rational reason why this should be happening. My object is not released by any of my code.
推荐答案
我最近遇到了完全相同的问题,但我不完全确定原因是否相同.不过,我可以告诉你的是什么为我解决了这个问题(尽管我对解决方案仍然不完全满意).
I had the exact same problem recently, however I am not entirely sure the cause is the same. What I can tell you though is what resolved the issue for me (although I'm still not entirely satisfied with the solution).
最后,这似乎是一个编译器问题,这可能证实了其他人所说的关于编译器优化的说法.我正在使用 Xcode 4.0(构建 4A304a).问题在于 LLVM 编译器 2.0 代码生成.特别是一个键:优化级别"
In the end, it seems like a compiler issue, and this might confirm what others have said about compiler optimization. I am using Xcode 4.0 (build 4A304a). The issue was with LLVM compiler 2.0 Code Generation. One key in particular: "Optimization Level"
调试设置为无".发布设置为最快、最小"
Debug was set to "None". Release was set to "Fastest, Smallest"
将 Release 更改为None"修复了崩溃(同样将 Debug 更改为Fastest, Smallest"会导致应用在启动时崩溃).
Changing Release to "None" fixed the crash (and similarly changing Debug to "Fastest, Smallest" caused the app the crash on launch).
这篇关于iPhone 应用程序仅在 3G 上的发布模式下崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!