Skip to content

Instantly share code, notes, and snippets.

@yeahq
Created April 15, 2012 10:09
Show Gist options
  • Save yeahq/2391691 to your computer and use it in GitHub Desktop.
Save yeahq/2391691 to your computer and use it in GitHub Desktop.
Load file
NSString *path;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"My Directory"];
path = [path stringByAppendingPathComponent:@"My Filename"];
if ([[NSFileManager defaultManager] fileExistsAtPath:path])
{
//File exists
NSData *file1 = [[NSData alloc] initWithContentsOfFile:path];
if (file1)
{
[self MyFunctionWantingAFile:file1];
[file1 release];
}
}
else
{
NSLog(@"File does not exist");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment