I am currently using the following code to post to my server:
[[[RKObjectManager sharedManager] HTTPClient] postPath:[NSString stringWithFormat:@"%@%@", baseURL, @"/api/v2/track-it/rack/individual"]
parameters:params
success:^(AFHTTPRequestOperation *operation, id responseObject) {
// handle success
if([[responseObject[@"result"] lowercaseString] isEqualToString:@"success"]){
// Entry was added
UIViewController *otherVC = [[UIStoryboard storyboardWithName:@"App" bundle:nil] instantiateViewControllerWithIdentifier:@"Dashboard"];
[self presentViewController:otherVC animated:YES completion:nil];
[self alertWithTitle:@"Track It Entry" message:@"The entry was uploaded successfully"];
} else {
// Couldn't add entry
[self alertWithTitle:@"Track It Entry" message:@"An error occured. Saving entry to upload later."];
}
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
// response code is in operation.response.statusCode
NSLog(@"ERROR");
}];
params is an NSDictionary of values.
How can I upload files with this?
I can't find any examples anywhere that aren't using a Managed Object.