iOS app crash only when not debugging

浪子不回头ぞ 提交于 2019-12-05 05:10:12

I had a similar problem and tried changing the project build settings, but it didn't work for me. Eventually solved my problem by changing the compiler optimization level setting for the release:

In Build Settings, go to the LLVM compiler 4.2 - Code Generation section, look for the Optimization Level option and change the Release setting from Fastest, Smallest [-Os] to None [-O0].

Hope this helps!

Change your Xcode Scheme so that you can Test and Debug a Release build, which uses the same compiler optimizations as your Ad Hoc build. Debugging a Debug build does not.

I ended up working out the problem. In my compiler settings, somehow, ARC wasn't enabled for Ad-Hoc builds resulting in weird behaviour. Before I worked this out, allocating the __block variable worked because in non-ARC environments, __block variables are not retained automatically.

Changed compiler settings so that all builds use ARC and everything was fixed.

In my case it was the "Enable Zombie Objects" setting that prevented the crash in debug mode. Debuggin without this setting made the app also crash in the debugger making it easy to find the culprit.

So I would advice to disable all settings in the "diagnostics" menu and set the optimizations to -Os and make a final test before releasing. Or as hotpaw2 pointed out, build in release mode. But this did not work for me due to issues with the certificate settings.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!