Skip to content

Instantly share code, notes, and snippets.

@rondy
Created July 20, 2012 14:27
Show Gist options
  • Save rondy/3151012 to your computer and use it in GitHub Desktop.
Save rondy/3151012 to your computer and use it in GitHub Desktop.
- (void) getDataFromLocalJSON
{
NSString *jsonPath = @"response.json";
NSFileHandle *file;
NSData *databuffer;
file = [NSFileHandle fileHandleForReadingAtPath: jsonPath];
if (file) {
databuffer = [file readDataToEndOfFile];
[file closeFile];
}
else {
NSLog(@"Failed to open file");
}
NSError *error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:databuffer options:kNilOptions error:&error];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment