Skip to content

Instantly share code, notes, and snippets.

@cconger
Created October 12, 2012 00:41
Show Gist options
  • Save cconger/3876668 to your computer and use it in GitHub Desktop.
Save cconger/3876668 to your computer and use it in GitHub Desktop.
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:"http://127.0.0.1/test"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[@"{json:goes, here:0}" dataUsingEncoding:nSUTF8StringEncoding]];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSURLConnection* conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[conn start];
//Then implement the delegate methods on self
// Defined here: https://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSURLConnectionDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSURLConnectionDelegate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment