Answer the question
In order to leave comments, you need to log in
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.
kCFURLErrorUserCancelledAuthentication
The connection failed because the user cancelled required authentication.
- (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];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question