NSURLConnection Error Code (-1202,1012)

I use NSURLConnection for a single-user application such as IOS, so the application is a type of field service, more than 50 users, and more than 50 users can use the application at the same time, more than 50 or 60 requests are sent to the server. Now my problem is that I got below two errors, as each user may encounter this error more than 5 times in one day. so for me it becomes a problem.

Error code:

-1202 NSURLErrorServerCertificateUntrusted

-1012 NSURLErrorUserCancelledAuthentication

I searched a lot and I found that they are server related errors , but still I have no solution to solve this problem.

Please help me how can I solve this NSURLConnection error (- 1202 NSURLErrorServerCertificateUntrusted and -1012 NSURLErrorUserCancelledAuthentication ).

Thanks in advance.

0
source share
1 answer

You need to use connectionWithRequest: delegate: accept untrusted certificates.

You can implement these delegate methods.

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace { return YES; } - (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection { return YES; } 
0
source

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


All Articles