关于ios项目沙盒中的文件和Xcode项目创建的文件

 //1.1获取在Xcode项目打开的情况下创建的Plist文件
 NSString *path = [[NSBundle mainBundle]pathForResource:@"ProfessionClassify" ofType:@"plist"];

 //1.2定义数组接收文件
 NSMutableArray *tempArray = [NSMutableArray arrayWithContentsOfFile:path];

 //2.1获取ios项目沙盒中的Plist文件(在项目中通过代码创建的Plist文件)
 NSString *documentDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
 NSString *selectedPath = [documentDirectory stringByAppendingPathComponent:@"Profession.plist"];

//2.2定义数组接收文件
NSMutableArray *selectedPathArray = [NSMutableArrayarrayWithContentsOfFile:selectedPath];

这两个是不同路径下的文件,互不相同,互不干扰。

原文地址:https://www.cnblogs.com/hw140430/p/3749053.html