I am using writeToFile to write an audio file to the local iphone directory. Next time I launch the app, the path / URL doesnt exist anymore and I cant retrieve my file.
Would appreciate any help.
Saving:
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];
Reading:
if ([[NSFileManager defaultManager] fileExistsAtPath:[urlArray objectAtIndex:indexPath.row]])
Where urlArray contains the path to the file and this If statement is false.
Why don’t u save filePath in NSMutableArray and that in NSUserDefault
Now u can read like this: