How can i perform following operation in AFNetworking "2.5". I wrote this code in older AFNetworking version:
-(void)login{
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
username.text,@"username",password.text,@"password",nil];
AFHTTPClient *httpClient= [[AFHTTPClient alloc]initWithBaseURL:[NSURL URLWithString:[NSString stringWithFormat:@"some_url"]]];
[httpClient registerHTTPOperationClass:[AFJSONRequestOperation class]];
[httpClient setDefaultHeader:@"Accept" value:@"application/json"];
[httpClient setAuthorizationHeaderWithToken:@"Token"];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"some_path" parameters:params];
[request addValue:@"some_value" forHTTPHeaderField:@"some_field"];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"Response- %@", responseObject);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error)
{
NSLog(@"Error- %@",error);
}];
[operation start];
}