Error 1012 when using SSL in AFNetworking 2.0

I am trying to connect to SSL on my website that uses a certified, signed StartSSL. When I browse the site, everything works fine, however, when I try to use SSL in the application, I get:

Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x8d635f0 {NSErrorFailingURLKey=https://edutoets.nl/API/login.php, NSErrorFailingURLStringKey=https://edutoets.nl/API/login.php}

I included the certificate in .cer format (after converting it from .crt to .cer with openssl) in the application suite, and AFNetworking can find it. Here is my code that creates the manager's security policy:

- (AFSecurityPolicy*) sslSecurityPolicy
{
    NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"edutoets" ofType:@"cer"];
    NSData *certData = [NSData dataWithContentsOfFile:cerPath];
    AFSecurityPolicy *securityPolicy = [[AFSecurityPolicy alloc] init];
    [securityPolicy setAllowInvalidCertificates:NO];
    [securityPolicy setPinnedCertificates:@[certData]];
    [securityPolicy setSSLPinningMode:AFSSLPinningModeCertificate];

    return securityPolicy;
}

And here I set the security policy and executed the request:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager;
[manager setSecurityPolicy:[self dodyrwSecurityPolicy]];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager POST:kLoginURL parameters:... success:...];

I don't know what I'm doing wrong here. The .cer file looks great (the certificate matches the certificate when viewed on a website). This happens on an iOS simulator.

Can anyone help me with this?

+4
3

, , . Afer, , !

+3

, 1012, SSL-, . ( ) AFNetworking v1. , . validatesCertificateChain = NO; .

+4

- .crt, . cat .crt -.

. ( !)

-

( . HTTPS Safari Chrome, " ", SSL.)

0

Source: https://habr.com/ru/post/1534499/