NSAssert 1 vs NSLog

NSAssert variants take a condition and a message. If the condition isn't met/true, then the assertion fails and NSAssert raises an exception with the message provided. For example, NSAssert((a == b), @"Error message"); will raise an exception when a is not equal to bNSAssert1 is a variant that takes an additional argument and inserts it into the format string provided, like so:NSAssert1((a == b), @"Error message: %@", someErrorString);

原帖地址:http://stackoverflow.com/questions/5496378/iphone-what-is-nsassert1

你可能感兴趣的:(exception,String)