0

I have been using AFHTTPClient class' postPath:parameters:success:failure: method. but it always call failure block only. I have been using AFNetworking 0.10 library. Can anyone tell me the possible reasons for this.

following is the code:

NSURL *nsUrl = [NSURL URLWithString:kURLAuthLogin];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:nsUrl];
[httpClient postPath:nil parameters:loginParams success:^(AFHTTPRequestOperation *operation, id responseObject) {

    NSLog(@"\n\n\n\n\n\n login success \n\n\n\n\n\n");

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {

    NSLog(@"\n\n\n\n\n\n login failed \n\n\n\n\n\n");

}];

There is no any problem with nsUrl or any other variable for sure.

2 Answers2

0

What happened is that your login failed. It would be common sense to

NSLog (@"%@", error);

to get the information you are looking for.

gnasher729
  • 51,477
  • 5
  • 75
  • 98
0

did you made your NSString to support NSURL with adding percentage.

example:-

 NSString *loginCredential=[@"Your Url with login and password" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
jayraj m.g.
  • 625
  • 5
  • 18