0

How to enable Assertions in objective?

I have added a third party library which has some Assertions. But it does not work. I think Assertions are disabled. So I want enable it.

Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
Shaheer Palolla
  • 265
  • 4
  • 11
  • You need to use [NSAssert](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html) for the assertions. Also this [post](http://stackoverflow.com/questions/1375786/whats-the-point-of-nsassert-actually) will be so useful for you. – Midhun MP Jun 26 '13 at 15:42
  • How did you use the `NSAssertion` ? – Midhun MP Jun 26 '13 at 15:58
  • I did not use NSAssertion but the library which i added have assertions. I simply need it to enable only. i cant see Assertion while debugging.@MidhunMP – Shaheer Palolla Jun 26 '13 at 16:05
  • By default its enabled. right? @MidhunMP – Shaheer Palolla Jun 26 '13 at 16:10
  • Yes. In default it is enabled – Midhun MP Jun 26 '13 at 16:11

1 Answers1

2

You need to use NSAssert for the assertions.

The NSAssertions are disabled if the NS_BLOCK_ASSERTIONS is specified.

You can use the NSAssert like:

NSAssert(count != 0, @"Count should be greater than zero"); 
Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
Midhun MP
  • 103,496
  • 31
  • 153
  • 200