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

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

问题描述

直到Xcode 5,使用默认的Build设置,可以防止发布版本包含 NSAssert 语句及其变体:

  OTHER_CFLAGS =-DNS_BLOCK_ASSERTIONS = 1; 

此设置可在 project.pbxproj 并在Xcode中设置为







$ p $(注意,这个抓取是从Xcode 4项目转换为Xcode 5的。)

b

每个目标都将在发布构建中继承此设置。显然这是一件好事。而不是立即崩溃,应用程序可能会奋斗,不管。而对于Debug构建,你想立即知道 NSAssert 失败。



但是,我很难找到


$ b

使用默认模板创建一个新项目没有相同的设置:



img src =https://i.stack.imgur.com/jkOiS.pngalt =enter image description here>



我的问题是,什么是在Xcode 5中的等价设置,或者 NS_BLOCK_ASSERTIONS 必须手动添加到发布版本的 Other C Flags

解决方案

现在有它自己的设置字段! 启用基础断言。将调试设置为yes,将您的发布设置为no,如下面的屏幕抓图所示。





注意:您需要点击构建设置标签左上角的全部才能查看,看到在我的屏幕抓住蓝色的所有在左上角。


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";

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

(Note that this grab was taken from an Xcode 4 project converted to Xcode 5.)

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.

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

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

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.

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

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