Skip to content

NSURLErrorServerCertificateUntrusted: iOS Fix

Key idea:

NSURLErrorServerCertificateUntrusted (code -1202) — the iOS/macOS Foundation Network layer rejected the server SSL cert. Cause: self-signed, expired, untrusted CA, empty SAN, or cert does not satisfy ATS (App Transport Security) requirements. In 2026 iOS requires TLS 1.2+, forward secrecy, SHA-256+ signature. Fix: real cert from Let's Encrypt/Sectigo, or for dev — NSAllowsArbitraryLoads (NOT production).

Below: causes, fixes, FAQ.

Check your site's SSL →

Common Causes

  • Self-signed cert in dev without bundle trust
  • App Transport Security (ATS) rejects TLS 1.0/1.1
  • Cert missing SAN (Subject Alternative Name) — iOS requires since 2017
  • CA not in iOS trust store (legacy Symantec roots retired)
  • Incomplete cert chain (missing intermediate)

Step-by-Step Fix

  1. Use a real cert from a mainstream CA (Let's Encrypt, DigiCert, Sectigo)
  2. Check chain: Enterno SSL Checker
  3. For dev: pin cert in-app via NSURLSessionDelegate urlSession:didReceiveChallenge:
  4. Info.plist: NSAppTransportSecurity > NSExceptionDomains for a specific domain (careful)
  5. Server TLS config: TLS 1.2+ + ECDHE + SHA-256

Check SSL Certificate →

Related SSL Errors

TL;DR

NSURLErrorServerCertificateUntrusted (-1202) indicates that your iOS or macOS device does not trust the SSL certificate presented by a server. This can occur due to expired certificates, unrecognized Certificate Authorities (CAs), or mismatched domain names. To resolve this issue, verify the certificate chain, ensure it is correctly configured, and check for any certificate revocation status using tools like OpenSSL or your browser's developer tools.

Understanding NSURLErrorServerCertificateUntrusted (-1202)

The NSURLErrorServerCertificateUntrusted error occurs when an application on iOS or macOS attempts to establish a secure connection and the SSL certificate presented by the server cannot be verified as trustworthy. This verification process involves several steps, including checking the certificate's validity period, the CA that issued the certificate, and whether the domain name matches the certificate.

When a device encounters an untrusted certificate, it will typically display a warning to the user, indicating that the connection is not secure. This error can stem from various issues:

  • Expired Certificates: If a certificate has passed its expiration date, it is considered invalid.
  • Unrecognized Certificate Authorities: If the CA that issued the certificate is not included in the device's trusted root certificate store, the certificate will be deemed untrusted.
  • Domain Mismatch: The domain name in the certificate must match the domain of the server being accessed. A mismatch will trigger the error.

To diagnose and resolve this issue, developers should use tools such as OpenSSL to inspect the certificate chain. The command openssl s_client -connect example.com:443 -showcerts can be executed in the terminal to view the certificate details and identify potential problems.

Practical Steps to Fix NSURLErrorServerCertificateUntrusted (-1202)

To resolve the NSURLErrorServerCertificateUntrusted (-1202) error, follow these steps:

  1. Check Certificate Expiration: Use the OpenSSL command to check if the certificate is still valid. For example:
openssl s_client -connect example.com:443 -servername example.com

Inspect the output for the notAfter field to confirm the certificate's expiration date.

  1. Verify Certificate Authority: Ensure that the CA of the certificate is recognized by your device. You can find the list of trusted CAs on the official Apple website or by comparing with the /etc/ssl/certs directory on macOS.
  2. Domain Name Check: Make sure that the domain name in the SSL certificate matches the server’s domain. Mismatches can occur if the certificate is issued for a different domain or subdomain.
  3. Use Certificate Pinning: In development environments, consider implementing SSL pinning to prevent this error. This involves including the public key or certificate hash in your app, ensuring it trusts only specific certificates.
  4. Update Your Application's Trust Settings: If you're developing an app, ensure that your app's networking code correctly handles SSL errors. Implement delegate methods to allow for custom error handling, such as:
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust { let serverTrust = challenge.protectionSpace.serverTrust if let serverTrust = serverTrust { completionHandler(.useCredential, URLCredential(trust: serverTrust)) } else { completionHandler(.performDefaultHandling, nil) } } }

By following these steps, you can effectively troubleshoot and resolve the NSURLErrorServerCertificateUntrusted (-1202) error, ensuring secure connections for your iOS or macOS applications.

CertificateExpiry, issuer, domains (SAN)
ChainIntermediate and root CA validation
TLS ProtocolTLS version and cipher suite
VulnerabilitiesHeartbleed, POODLE, weak ciphers

Why teams trust us

TLS 1.3
supported
Full
CA chain check
<2s
result
30/14/7
days-to-expiry alerts

How it works

1

Enter domain

2

TLS chain verified

3

Expiry date & vulnerabilities

What Does the SSL Check Cover?

SSL/TLS is the encryption protocol that protects data between the browser and server. Our tool analyzes the certificate, chain of trust, TLS version, and knownvulnerabilities.

Certificate Details

Issuer, validity period, signature algorithm, covered domains (SAN), and validation type (DV/OV/EV).

Chain of Trust

Full chain verification: from leaf certificate through intermediates to root CA.

TLS Analysis

Protocol version (TLS 1.2/1.3), cipher suites, Perfect Forward Secrecy (PFS) support.

Expiry Alerts

Set up a monitor — get Telegram and email alerts 30/14/7 days before expiration.

DV vs OV vs EV Certificates

DV (Domain Validation)
  • Confirms domain ownership only
  • Issued in minutes automatically
  • Free via Let's Encrypt
  • Suitable for most websites
  • Most common certificate type
OV / EV
  • Organization (OV) or Extended Validation (EV)
  • Issued in 1-5 business days
  • Costs $50 to $500/year
  • For finance, e-commerce, government sites
  • Increases user trust

Who uses this

DevOps

SSL certificate monitoring

Security

TLS config audit

SEO

HTTPS as ranking factor

E-commerce

customer trust

Common Mistakes

Expired certificateBrowsers block sites with expired SSL. Set up auto-renewal or monitoring.
Incomplete certificate chainWithout intermediate CA, some browsers and bots cannot verify the certificate.
Mixed content on HTTPS siteHTTP resources on an HTTPS page — the browser lock icon disappears, reducing trust.
Using TLS 1.0/1.1Legacy TLS versions have known vulnerabilities. Use TLS 1.2+ or 1.3.
Domain mismatch in certificateThe certificate must cover all site domains, including www and subdomains.

Best Practices

Set up auto-renewalLet's Encrypt + certbot with cron — certificate renews automatically every 60-90 days.
Enable HSTSStrict-Transport-Security header forces browsers to always use HTTPS.
Use TLS 1.3TLS 1.3 is faster (1-RTT handshake) and safer — legacy ciphers removed.
Monitor expiration datesCreate a monitor on Enterno.io — get notified well before expiration.
Verify chain after renewalAfter certificate renewal, confirm that intermediate certificates are installed.

Get more with a free account

SSL certificate monitoring, check history and alerts 30 days before expiry.

Sign up free

Learn more

Sources

Frequently Asked Questions

Allow self-signed in dev?

Info.plist → NSAppTransportSecurity → NSExceptionDomains → your-dev-domain → NSExceptionAllowsInsecureHTTPLoads=YES. Debug builds only.

Certificate pinning best practice?

SHA-256 cert hash or SPKI pin. Rotate with the cert, validate on every build.

iOS ignores self-signed?

Yes, Foundation by default. Needs a custom trust eval via URLSessionDelegate.

ATS requirements 2026?

TLS 1.2+, ECDHE forward secrecy, AES-128-GCM+, SHA-256 signature. Cert with SAN (mandatory).

Try the live tool that powered this guide

Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.