0

Here is my code

AFHTTPRequestOperationManager *opManager = [AFHTTPRequestOperationManager manager];

opManager.responseSerializer = [AFJSONResponseSerializer serializer];
[opManager.requestSerializer setValue:@"no-cache" forHTTPHeaderField:@"Cache-Control"];

opManager.securityPolicy.allowInvalidCertificates = NO;
opManager.securityPolicy.validatesCertificateChain = NO;

NSDictionary* parameters = @{@"phone_number":self.phoneNumberTextField.text,
                             @"password":self.passwordTextField.text};

[opManager POST:@"http://www.example.com:8080/api.php/login"
     parameters:parameters
        success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"Login Response Object %@",responseObject);
}
        failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"Login2222-2 - %@",error);
}];

Here is my error

Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorCodeKey=-9836, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSUnderlyingError=0x28185ce40 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSErrorFailingURLStringKey=https://www.example.com:8080/api.php/login, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFNetworkCFStreamSSLErrorOriginalValue=-9836, _kCFStreamPropertySSLClientCertificateState=0, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., _kCFStreamErrorDomainKey=3, NSErrorFailingURLKey=https://www.example.com:8080/api.php/login, _kCFStreamErrorCodeKey=-9836}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://www.example.com:8080/api.php/login, NSErrorFailingURLStringKey=https://www.example.com:8080/api.php/login, _kCFStreamErrorDomainKey=3}

Normal for the first time login.For the second time, these error is indicated.

Test
  • 131
  • 1
  • 9
  • Does this answer your question? [iOS9 getting error “an SSL error has occurred and a secure connection to the server cannot be made”](https://stackoverflow.com/questions/32755674/ios9-getting-error-an-ssl-error-has-occurred-and-a-secure-connection-to-the-ser) – Phil Dukhov Sep 15 '21 at 09:20
  • @PhilipDukhov was the same as tested – Test Sep 15 '21 at 09:23

0 Answers0