0

I received a big iOS project, in this project every NSAssert() are skipped even in debug!

I added a test to check is NS_BLOCK_ASSERTIONS is defined even in debug mode and no, it isn't defined.

#ifdef NS_BLOCK_ASSERTION
    NSLog(@"Assertion are blocked");
#endif

Old C-style assert() are called as usual.

This code:

NSLog(@"AA");
NSAssert(FALSE,@"TRY ASSERT");
NSLog(@"BB");

produce this preprocessed code

    if (!(0)) {
    [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd
                                                        object:self
                                                          file:[NSString stringWithUTF8String:"/Users/..../AppDelegate.m"]
                                                    lineNumber:106
                                                   description:(@"TRY ASSERT")];
}

and i correct my post, NSAssert aren't skipped, but the app simply hangs, even if the NSAssert are TRUE :(

IgnazioC
  • 4,554
  • 4
  • 33
  • 46
  • 1
    Open one of your compilation units that has the `NSAssert` macro in it, open the assistant editor, and choose the `Preprocess` view. Take a look at what those lines are getting pre-processed into. – Jason Coco Jul 30 '13 at 16:15
  • Did you install your own root-level assertion handler? If not, is it possible you added a library that installed one that's misbehaving? Try breaking on exceptions and stepping up into whatever the root level handler is, if you're unsure. If it's hanging, it sounds like your handler is misbehaving. – Jason Coco Jul 30 '13 at 20:25

0 Answers0