Xcode 5 equivalent of NS_BLOCK_ASSERTIONS in Build Settings

限于喜欢 提交于 2019-11-27 03:21:06

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/20377845/xcode-5-equivalent-of-ns-block-assertions-in-build-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!