简体   繁体   English

为什么安装后第一次运行时我的iPhone应用程序的发布版本会在设备上崩溃?

[英]Why does the release build of my iPhone app crash on the device on the first run after installation?

I have an iPhone app that's been in development for about 2 weeks. 我有一个iPhone应用程序已经开发了大约2周。 We recently tried the "release" version of the build on a device, and to our great unhappiness, it crashes in one of the views with an "EXC_BAD_ACCESS". 我们最近尝试在设备上进行构建的“发布”版本,并且由于我们非常不满意,它在其中一个视图中以“EXC_BAD_ACCESS”崩溃。

This crash only occurs on devices, and only in the "release" build. 此崩溃仅发生在设备上,并且仅发生在“发布”版本中。 Not only that, but it only happens the first time the app is launched! 不仅如此,它只会在应用程序首次启动时发生! It is also 100% reproducible. 它也是100%可重复的。

We have removed the small block of code that deals with data persistence, and have tried re-openning Xcode, cleaning the project, deleting and reinstalling the app, etc., as some other questions suggest. 我们已经删除了处理数据持久性的小块代码,并尝试重新打开Xcode,清理项目,删除和重新安装应用程序等,正如其他一些问题所示。

Do you have any advice for a) what might be causing this problem, and b) how to go about debugging if it only happens in "release"? 您是否有任何建议:a)可能导致此问题的原因,以及b)如果仅在“发布”中发生,如何进行调试?

Thanks 谢谢

It turns out there was no problem in the code at all. 事实证明,代码中没有任何问题。

The reason it was crashing was that Xcode was trying to attach the debugger to the release build for some reason! 崩溃的原因是Xcode试图将调试器附加到发布版本由于某种原因! We are still trying to figure out why, because we have checked the most obvious places, but I'm sure it won't be too hard to track down. 我们仍然在试图找出原因,因为我们已经检查了最明显的地方,但我确信它不会太难追查。

The build works fine if you install from iTunes or the Xcode organizer instead of building and running from Xcode directly, so it won't affect your end-users at all, as long as you are careful to check for other first-run issues. 如果您从iTunes或Xcode组织器安装而不是直接从Xcode构建和运行,则构建工作正常,因此只要您仔细检查其他首次运行问题,它就不会影响您的最终用户。

We can only guess what the cause might but if it's 100% reproducible, then it should be a good candidate for some fprintf-style debugging. 我们只能猜测原因可能是什么,但如果它是100%可重复的,那么它应该是一些fprintf式调试的良好候选者。

Figure out the most probable place for the error to occur, and start putting "Got past xxx view initialization" style statements in to start narrowing the problem. 找出发生错误的最可能的位置,并开始将“得到过去xxx视图初始化”样式语句开始缩小问题范围。 It's tedious, but eventually, you'll get there. 这很乏味,但最终,你会到达那里。

In theory fprintf statements could affect the problem. 理论上,fprintf语句可能会影响问题。 However, it's rare that it does so, so it's a good place to start. 然而,它很少这样做,所以这是一个很好的起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM