NSAssert函数:
1 NSAssert(condition, desc, ...);
1. condition:条件,如果条件满足则程序正常之行,如果条件不满足则程序崩溃,奔溃的信息可以由后面的desc来打印出来:
实例如下:
NSInteger age = 10; NSAssert(age == 01, @"the condition is not right -%s--%s---%d",__FILE__,__FUNCTION__,__LINE__);
这时打印出来的信息为:
Terminating app due to uncaught exception ‘NSInternalInconsistencyException‘, reason: ‘Unable to find archive in bundle.-/Users/robot/Desktop/BornToTry/BornToTry/ViewController.m---[ViewController viewDidLoad]---32‘
时间: 2024-07-30 22:43:17