Xcode DEBUG模式 - 何时开/关? [英] Xcode DEBUG Mode - when is it on/off?

查看:395
本文介绍了Xcode DEBUG模式 - 何时开/关?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,这在开发模式下工作(在模拟器上进行测试等):

I have noticed that this works in dev mode (testing on the simulator, etc):

#ifdef DEBUG
    //do stuff
#endif

但是当我归档和分发测试版本时,该应用程序不会采取DEBUG模式,即使我仍在构建与开发人员配置文件。我希望DEBUG模式永远是这样,除非我使用部署配置文件构建并提交给Apple。

But when I archive and distribute test builds, the app does not act in DEBUG mode even though I'm still building with the developer profile. I would like DEBUG mode to always be the case unless I build with the deployment profile and submit to Apple.

例如,当发送测试版本时,我不想让人们购买应用内购买,所以我做这样的事情:

For example, when sending test builds out, I don't want to make people buy an in-app purchase, so I do something like this:

- (BOOL)isUpgradePurchased
{
#ifdef DEBUG
    return YES;
#endif

//do the real stuff to determine if purchased and return YES or NO
}

那么我还需要为Release设置一个预处理器宏DEBUG = 1?

So do I also need to set a preprocessor macro DEBUG=1 for "Release"?

推荐答案

您还可以通过编辑方案在归档时构建调试配置。请参阅XCode中编辑方案对话框的屏幕截图。

You can also "Edit Scheme" to build Debug Configuration when archiving. See screenshot of "Edit Scheme" dialog in XCode.

这篇关于Xcode DEBUG模式 - 何时开/关?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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