0
我有这2行代码:不能读取与写入将writeToFile数据:原子
[[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://somepath.com/first.plist"]] writeToFile:@"first.plist" atomically:YES];
NSDictionary *dTmp=[[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"first" ofType:@"plist"]];
但我dTMP的为空。我没有指定任何路径,所以它应该存储在根目录中,对吧? 我的错误是什么?
你不能在mainBundle中写入。 – Larme
你可以在'NSDocumentDirectory' /'NSCachedDirectory'中写文件 –
谢谢,我要检查这个。 – NGG