如何调试发行版本
好吧
,最近我在调试模式下工作但不在分发模式下工作的应用程序遇到了很多麻烦。
是否可以在应用程序的临时分发版本中使用 Xcode 调试工具(例如断点和变量跟踪)?
如果不是的话,人们通常会如何调试这样的事情呢?
Ok
SO recently I've being having a lot of trouble with an application working in debug mode but not working in distribution mode.
Is it possible to use xcode debugging tools such as break points and variable tracing with an adhoc distribution build of an app?
If it's not how would one usually go about debugging such a thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您的崩溃日志没有给您任何线索(您需要连接到设备才能获取它们),您可以做很多事情。
但我首先要查看崩溃日志……线索就在那里,不要忘记 Apple 通过 iTunesConnect 向您提供分发崩溃日志。
1)大量日志记录是一回事。许多开发人员使用开关,以便在调试时,日志转到控制台,但对于其他构建,日志会被删除。考虑使用不同的选项,将日志记录到文件中。然后,您可以将日志文件推送到远程服务器进行调试。设置这一切有点困难,但是一旦完成,您就会想知道如果没有它您将如何生活。
2) 另一种选择是使用 Flurry 并在检测到出现问题时记录事件。当事情不符合预期时,这可以涵盖更受控制的问题,而不是随机崩溃。如果您的条款和条件清楚地说明您正在记录哪些数据以及原因,这对于已发布的应用程序来说可能是一个有用的功能。
3)确保你做了一个干净的构建,我确信你已经这样做了,但有时它可以解决这些问题。
4)您是否使用外部库/模块?我遇到过旧版本 TT 的问题,其中 arm6/7 构建设置错误,这导致了发行版构建出现问题。基本上检查每个配置文件的构建设置,并确保它符合您的期望。
5) 怀疑竞争条件。在分发模式下(通常是因为日志记录被关闭),您会发现应用程序运行得更快一些。这可以揭示编写糟糕的代码中的计时问题错误。
所以是的...您可以做很多事情...您只是无法附加调试器;-)
Assuming that your crash logs aren't giving you any clues (you'll need to hook up to the device to get them) there are lots of things you can do.
But I'd start by looking at the crash logs ... the clues will be there and don't forget Apple make distribution crash logs available to you through iTunesConnect.
1) Copious logging is one thing. Lots of developers use a switch so that in debug, logs go to the console but for other builds they are dropped. Consider a different option where you log to a file instead. You could then push the log files to a remote server for debugging. It's a bit of a slog to set this all up, but once you've done it, you'll wonder how you ever lived without it.
2) Another option is to use Flurry and log events when you detect that things have gone wrong. This can cover more controlled problems when things aren't as expected rather than random crashes. This can be a useful feature for released apps provided your terms and conditions are clear about what data you are logging and why.
3) Make sure you do a clean build, I'm sure you've already done this, but sometimes it clears these issues.
4) Are you using external libraries / modules? I've come across issues with older versions of TT where the arm6/7 build settings were wrong and this was causing issues for distribution builds. Basically check through the build settings for each profile and make sure it is what you expect.
5) Suspect a race condition. In distribution mode (often because the logging is turned off) you will find that your application runs a little bit faster. That can reveal timing issue bugs in badly written code.
So yes ... there is a lot you can do ... you just can't attach the debugger ;-)
无法在分发模式下调试应用程序。
分发、调试和发布之间的构建配置差异实际上是您在 XCode 中为其设置的参数。如果您的发行版配置给您带来了问题,而发行版却没有出现问题,那么最简单的修复方法是返回 Apple 的步骤,复制发行版配置并进行更改以使其成为发行版配置,就像您最初所做的那样。
另一种方法是检查发布和分发的每一行配置并找出不同之处。另一种方法要快得多。 :)
Not possible to debug an application in distribution mode.
The build configuration difference between Distribution, Debug, and Release is really whatever parameters you have set for that in XCode. If your Distribution config is giving you problems and the release isn't, the easiest way to fix it is to go back through Apple's steps on copying the Release config and making the changes to make it a Distribution config, like you did originally.
The alternative is to go through every line of the configurations for Release and Distribution and find what's different. The other way is a LOT faster. :)