Last active
October 1, 2015 22:49
-
-
Save jasonmcdermott/fd65849a8e0ebbeb1a14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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