/**
* 读取数据
*/
- (IBAction)didClickReadDataButton {
// 读取路径
NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *filePath = [docPath stringByAppendingPathComponent:@"names.plist"];
NSArray *names = [NSArray arrayWithContentsOfFile:filePath];
NSAssert(names, @"没有数据");
for (NSString *name in names) {
NSLog(@"%@",name);
}
}
names读取为空会报错误就是你输入的提示信息: reason: '没有数据';
测试阶段让断言执行 ;
当release下可以忽略断言
选择build,选择release。在gcc preprocessing下增加Preprocessor Macros 值为 NS_BLOCK_ASSERTIONS.
浙公网安备 33010602011771号