Skip to content

Instantly share code, notes, and snippets.

@jasonmcdermott
Last active October 1, 2015 22:49
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 jasonmcdermott/fd65849a8e0ebbeb1a14 to your computer and use it in GitHub Desktop.
Save jasonmcdermott/fd65849a8e0ebbeb1a14 to your computer and use it in GitHub Desktop.
// Note this snippet requires AFNetworking v2.x
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.securityPolicy.allowInvalidCertificates = YES;
manager.requestSerializer = [AFJSONRequestSerializer serializer];
NSMutableDictionary *result = [[NSMutableDictionary alloc] init];
result[@"username"] = @"JohnSmith";
result[@"email"] = @"john@msith.com";
result[@"phone"] = @"06543213131";
result[@"name"] = @"John Smith";
NSLog("%@",result);
[manager
POST: @"http://project-staging.com/clients/dresden/api/customer/new"
parameters: result
success:^(AFHTTPRequestOperation *operation, id responseObject){
// currently responseobject logs as "(null)". No idea why
NSLog("%@",responseObject);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error){
NSLog(@"Error: %@", error);} // failure callback block
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment