Skip to content

Instantly share code, notes, and snippets.

@danneu
Forked from mahemoff/ios.c
Created August 17, 2012 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danneu/3376150 to your computer and use it in GitHub Desktop.
Save danneu/3376150 to your computer and use it in GitHub Desktop.
iOS example
// Async web fetch with JSON parse
[NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"url"]]
queue:nil completionHandler:^(NSURLResponse *r, NSData *d, NSError *e) {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:d
options:0
error:nil];
}];
// Using the camera
- (void)takePicture:(id)sender
{
UIImagePickerController *c = [[UIImagePickerController alloc] init];
[c setDelegate:self];
[self presentViewController:c animated:YES completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)ipc didFinishPickingMediaWithInfo:(NSDictionary *)d
{
UIImage *img = [d objectForKey:UIImagePickerControllerOriginalImage];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment