Xcode 5 相当于构建设置中的 NS_BLOCK_ASSERTIONS [英] Xcode 5 equivalent of NS_BLOCK_ASSERTIONS in Build Settings

查看:17
本文介绍了Xcode 5 相当于构建设置中的 NS_BLOCK_ASSERTIONS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Xcode 5 之前,可以使用默认构建设置阻止发布构建包含 NSAssert 语句及其变体:

Until Xcode 5, Release builds could be prevented from including NSAssert statements and their variants, using the default Build Setting:

OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";

此设置可以在 project.pbxproj 中找到,并在此处的 Xcode 中设置:

This setting can be found in project.pbxproj and is set in Xcode here:

(请注意,此图片取自已转换为 Xcode 5 的 Xcode 4 项目.)

每个目标将仅在发布版本中继承此设置.显然这是一件好事.该应用程序不会立即崩溃,而无论如何都可能会挣扎.而对于 Debug 构建,您希望在 NSAssert 失败时立即知道.

Each target would inherit this setting in the Release build only. Obviously this was a good thing. Rather than crash immediately, the app would possibly struggle on regardless. Whereas for Debug builds, you want to know immediately when an NSAssert fails.

然而,我正在努力在 Xcode 5 中找到等价物.

However, I am struggling to find the equivalent in Xcode 5.

使用默认模板创建新项目显示没有等效设置:

Creating a new project using the default templates shows no equivalent setting:

我的问题是,Xcode 5 中的等效设置是什么,还是必须将 NS_BLOCK_ASSERTIONS 手动添加到发布版本的 Other C Flags 中?

My question is, what is the equivalent setting in Xcode 5, or does NS_BLOCK_ASSERTIONS have to be added manually to Other C Flags for the Release build?

推荐答案

现在有了自己的设置字段!启用基础断言.将您的调试设置为是,将您的发布设置为否,如下面的屏幕截图所示.

It's got it's own setting field now! Enable Foundation Assertions. Set your debug as yes and your release as no, as shown in screen grab below.

注意:您需要单击构建设置选项卡左上角的 All 才能看到它,您可以在我的屏幕中看到左上角的蓝色 ALL.

Note: You need to click All in the top left in your build settings tab to see it, you can see in my screen grab the blue ALL in the top left.

这篇关于Xcode 5 相当于构建设置中的 NS_BLOCK_ASSERTIONS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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