Search code examples
objective-cnsassert

NS_BLOCK_ASSERTIONS does not block an assertion in a static library


NS_BLOCK_ASSERTIONS does not block an assertion failure coming from a static library. How do we suppress assertion failure coming from a static library?


Solution

  • NS_BLOCK_ASSERTIONS must be defined at compile time. If the library has been compiled with assertion code that you want to suppress (which sounds extremely dangerous), you will need to create a subclass of NSAssertionHandler that ignores those particular failures and install it in the thread dictionary.