我正在使用以下代码行::
- (void)sync:(NSString *)savedName{
NSLog(@"saved name is this :: %@", savedName);
NSString *savedDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *saveFilePath = [savedDir stringByAppendingPathComponent:savedName];
saveFilePath = [saveFilePath stringByAppendingPathComponent:@"edit.txt"];
NSString *saveString = [NSString stringWithContentsOfFile:saveFilePath encoding:NSUTF8StringEncoding error:nil];
NSLog(@"saveString is :: %@ savedName : %@ savefilepath : %@", saveString, savedName, saveFilePath);
}
的内容edit.txt
是:
= WWWW =
[[Category:ssss]]
我要做的是从文件中读取edit.txt
并将其内容存储在字符串中。但是,在 NSLogging 上,我得到null
了saveString
.
gdb
我在::得到以下输出
splitView[838:f803] saveString is :: (null) savedName : xxxx savefilepath : /Users/xxxx/Library/Application Support/iPhone Simulator/5.1/Applications/D4B3A4CF-E7D0-4D25-B3D3A170A329/Documents/xxxx/edit.txt`
有人可以帮我解决错误吗?我无法弄清楚。谢谢并恭祝安康。