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

问题描述

直到X code 5,发布版本可以从包括 NSAssert 语句及其变种,使用默认的构建设置pvented $ P $:

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 发现放在X code在这里设置:

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

(注意,这是抢在X code 4项目转换为X code 5拍摄。)

每个目标将继承在仅发布版本此设置。显然,这是一件好事。而不是立即崩溃,应用程序可能会挣扎就不管。而对于调试版本,要立即知道当一个 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.

不过,我苦苦寻找的X code 5的等价物。

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

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

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

我的问题是,什么是X code 5的等效设置,或者确实 NS_BLOCK_ASSERTIONS 必须手动添加到其他C标志的发布版本?

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.

请注意:您需要单击全部左上角在构建设置选项卡,看到它,你可以在我的屏幕上看到抢蓝色全部左上角。

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.

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

09-03 06:25