Saturday, 10 August 2013

Expected status code in (200-299), got 404

Expected status code in (200-299), got 404

This is my code:
NSURL *url = [NSURL
URLWithString:@"http://wspublisherv2.skygiraffe.com/WSpublisherV2.svc/Authenticate"];
AFHTTPClient *client = [[AFHTTPClient alloc]initWithBaseURL:url];
NSDictionary *parameters = [NSDictionary
dictionaryWithObjectsAndKeys:@"john@sgdemo.com", @"UserName", @"123",
@"Password", nil];
NSLog(@"%@", parameters);
[client postPath:nil parameters:parameters
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"success: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"failure: %@", error);
}];
It always triggers the failure block and I get the "Expected status code
in (200-299), got 404" message.
When I try it through Fiddler it works.

No comments:

Post a Comment