K
K
KurazhBambei2014-06-25 14:28:06
Objective-C
KurazhBambei, 2014-06-25 14:28:06

Has anyone experienced the kCFURLErrorUserCancelledAuthentication -1012 error on iOS?

I implement in the application the signing of requests with client certificates that were obtained in advance. When I try to run a query I get this error

kCFURLErrorUserCancelledAuthentication -1012.

The documentation says:
kCFURLErrorUserCancelledAuthentication
The connection failed because the user cancelled required authentication.

I implement it like this
- (void)startConnection {
    NSString *serverURL = @"host.ru/method";
    MKNetworkEngine *engine = [[MKNetworkEngine alloc] initWithHostName:serverURL customHeaderFields:nil];
    MKNetworkOperation *op = [engine operationWithPath:nil params:nil httpMethod:@"GET" ssl:YES];
    
    NSString *thePath = [[NSBundle mainBundle] pathForResource:@"client" ofType:@"p12"];
    [op setShouldContinueWithInvalidCertificate:YES];
    op.clientCertificate = thePath;
    op.clientCertificatePassword = @"1234qwerty";
    
    [op addCompletionHandler:^(MKNetworkOperation *operation) {
        NSLog(@"[operation responseData]-->>%@", [operation responseString]);
    }errorHandler:^(MKNetworkOperation *errorOp, NSError* err) {
        NSLog(@"MKNetwork request error : %@", [err localizedDescription]);
    }];
    
    [engine enqueueOperation:op];   
}

What could be the problem guys? Has anyone come across?
PS.
For an android application to the same server, requests go through normally, according to the same scheme.

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
D
Denis Morozov, 2014-06-25
@morozovdenis

have you looked at this: HTTPSTestEngine.m ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question