Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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
You can’t perform that action at this time.