Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


NS_BLOCK_ASSERTIONS=1 by default for Pod porject #802

garnett opened this Issue · 7 comments

6 participants


Hi guys,
I've discovered an disturbing issue with triggering NSAssert macro in Release code. The problem was discovered in libs managed by CocoaPods.

By default, every xcode project has a -DNS_BLOCK_ASSERTIONS=1 in Release/AdHoc configuration. Is there any way to add these flags to Pods project or maybe to .xcconfig by default?

Should be included in:


This is indeed something that needs to be fixed.

It was also recently brought up on the mailing-list. @olarivain, do you have an idea on when you could work on this?


Btw, another one to be optionally included is NDEBUG (shuts down assert(), etc)

@xslim xslim referenced this issue from a commit in xslim/CocoaPods
@xslim xslim Added set_dns_block_assertions_flag! to fix #802 81fe06f

I added ability to add this -DNS_BLOCK_ASSERTIONS=1 via flag set_dns_block_assertions_flag! in Podfile.
Or maybe it's better just to add this as a default option?


This has been fixed in Xcodeproj of which we’ll release a new version today: CocoaPods/Xcodeproj#53.

@alloy alloy closed this

Hey @alloy is there a way to disable NS_BLOCK_ASSERTIONS? My Pod uses assertions to verify some absolutely critical preconditions for the use of my APIs. Disabling asserts doesn't mean that those preconditions go away--it just makes it harder for the user to find out what went wrong if they misread the docs.

EDIT: Pardon, I misread the change--it looks like assertions are still enabled in debug. That's fine then.


I've run into a similar issue today on one of my projects. We have two development components (one managed by a separate pod) that uses many custom-ly named debug schemes. However, we just found out that none of the assertions that we have set in our pod project are ever being fired in the other debug schemes because CocoaPods automatically blocks assertions for any build schemes not named "Debug". Is there any way to disable setting -DNS_BLOCK_ASSERTIONS=1 for custom schemes without having to manually change it after every pod update?

@fabiopelosin fabiopelosin referenced this issue in CocoaPods/Xcodeproj

Generate targets with same build settings as Xcode (related to #164) #166

8 of 8 tasks complete

Reviewing CocoaPods/Xcodeproj#166 I think that the assertions should be handled by CocoaPods. Actually I'm wondering if they should be handled at the spec level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.