I have an app that generates a .pdf file from a picture. If I go read the file in the same session as I took the picture, the file shows up properly.
However, if I r
You shouldn't store raw file paths for persistence (or if you do, know that the root can move on you). A better practice would be to only store the relative part of the path and always attach it to the current "root" path in question (particularly if you might be sharing data across devices as with iCloud).
Still, it is common to take the shortcut, so here's some quick-and-dirty code to take a file path (assumed to be in the Documents directory, you can tweak to taste if you're using a different location) and update it to the current Documents path.
+ (NSString *)rebasePathToCurrentDocumentPath:(NSString *)currentFilePath
{
NSString *fileComponent = [currentFilePath lastPathComponent];
NSArray *currentDocumentDir = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *currentDocumentPath = [currentDocumentDir objectAtIndex: 0];
NSString *rebasedFilePath = [currentDocumentPath stringByAppendingPathComponent:fileComponent];
return rebasedFilePath;
}
Attach this to a utils class or otherwise integrate it into your flow..