Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
410 views
in Technique[技术] by (71.8m points)

compiler construction - Xcode 5 equivalent of NS_BLOCK_ASSERTIONS in Build Settings

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...