NS_BLOCK_ASSERTIONS=1 by default for Pod porject #802

Closed
garnett opened this Issue Feb 19, 2013 · 7 comments

Comments

Projects
None yet
6 participants
Contributor

garnett commented Feb 19, 2013

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:
OTHER_CPLUSPLUSFLAGS
OTHER_CFLAGS

Owner

alloy commented Feb 19, 2013

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?

Contributor

garnett commented Feb 19, 2013

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

Contributor

xslim commented Feb 19, 2013

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?

Owner

alloy commented Feb 20, 2013

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

@alloy alloy closed this Feb 20, 2013

jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013

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 Jul 20, 2014

Merged

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

8 of 8 tasks complete
Owner

fabiopelosin commented Jul 20, 2014

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