Xcode 5 equivalent of NS_BLOCK_ASSERTIONS in Build Settings

2.3k views Asked by At

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:

enter image description 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:

enter image description here

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

There are 1 answers

1
BooRanger On BEST ANSWER

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.

enter image description here

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.