AFHTTPRequestOperationManager POST request fails with network connection was lost (-1005)

Viewed 567

my server side is google compute engine with DJango services as API

this is the code I'm running in xcode IOS 6.1

static NSString *const BaseURLString = @"http://myUrl/";

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
[manager POST:BaseURLString
   parameters:[self getParameters]
      success:^(AFHTTPRequestOperation *operation, id responseObject) {
          NSArray *returnedData = (NSArray *)responseObject;
          [self doSomething:returnedData];
      }
      failure:^(AFHTTPRequestOperation *operation, NSError *error) {
          UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Error Retrieving Properties" message:[NSString stringWithFormat:@"%@", error] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
          [av show];
      }];

It always fails with Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." but when I call the service from the terminal using curl -datacurl --data "param1=1&param2=3" http://myUrl/ it works perfect

1 Answers
Related