Skip to content

Instantly share code, notes, and snippets.

@jooddang
Created February 20, 2012 12:51
Show Gist options
  • Save jooddang/1869069 to your computer and use it in GitHub Desktop.
Save jooddang/1869069 to your computer and use it in GitHub Desktop.
getting NSURL from NSString
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachePath = [paths objectAtIndex:0];
NSString *chunkDirectory = [[NSString alloc] initWithFormat:@"%@/CHUNK/dd", cachePath];
NSURL *url = [NSURL fileURLWithPath:chunkDirectory];
//url = file://localhost/Users/jooddang/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/67AE-MY-IPHONE-ID-ABC87EC/Library/Caches/CHUNK/dd
[[NSFileManager defaultManager] fileExistsAtPath:chunkDirectory]; // returns 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment