【发布时间】:2012-06-20 04:11:48
【问题描述】:
由于我需要在启动应用程序时读取文件并有时在使用它时写入文件,因此我尝试通过以下方式访问它:
NSString *dataFile = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"txt"];
NSLog(@"%@",dataFile);
而应该在我的项目文件夹中的文件却在模拟器文件夹中:
2012-06-13 17:36:56.398 MyFileApp[610:15203] /Users/Rob/Library/Application Support/iPhone Simulator/5.1/Applications/1FFD4436-DCCA-4280-9E47-F6474BEE0183/MyFileApp.app/我的文件.txt
所以如果我想在模拟器和真机上读/写它,我该怎么办?
感谢您的建议
【问题讨论】:
标签: objective-c ios nsfilemanager read-write