【发布时间】:2012-08-28 13:06:47
【问题描述】:
我正在使用 writeToFile 将音频文件写入本地 iphone 目录。下次我启动应用程序时,路径/ URL 不再存在,我无法检索我的文件。
不胜感激。
保存:
NSArray *dirPaths;
NSString *docsDir;
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
NSString *tempFileName = [[NSString alloc] init];
tempFileName = [[alertView textFieldAtIndex:0]text];
NSString *soundFilePath = [docsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.wav", tempFileName]];
BOOL success = [videoData writeToFile:soundFilePath atomically:YES];
阅读:
if ([[NSFileManager defaultManager] fileExistsAtPath:[urlArray objectAtIndex:indexPath.row]])
其中 urlArray 包含文件的路径,并且此 If 语句为 false。
【问题讨论】:
-
网址是怎么做的?
-
你检查过你的文件已经写入你的目录了吗?
标签: iphone objective-c ios xcode