我试图在文档目录的外面创建/编写pList文件,但是我收到了这个错误:
error writing to file: Error Domain=NSCocoaErrorDomain Code=4 "The folder “spanishPlayground-toys.plist” doesn’t exist." UserInfo=0x618000278200 {NSFilePath=/Users/myUser/Volumes/Depot/proyects/myApp/Assets/config.plist, NSUserStringVariant=Folder, NSUnderlyingError=0x618000247140 "The operation couldn’t be completed. No such file or directory"}
这是我的代码:
NSString * filePath = [NSHomeDirectory()stringByAppendingPathComponent:@" /Volumes/Depot/proyects/myApp/Assets/config.plist"];
BOOL writeStatus = [plistData writeToFile: filePath
options: NSDataWritingAtomic
error: &error]; if (!writeStatus) {
NSLog (@"error writing to file: %@", error);
return; }
你们中任何人都知道如何在文件目录之外写文件?
我真的很感谢你的帮助。