Error Domain=NSURLErrorDomain Code=-1202 The certificate for this server is invalid
You can't use a self-signed certificate without first setting up the device to trust the certificate that did the signing (i.e., the certificate itself, since it signed itself). So you will need to find a way to open that certificate in iOS so that it can be added to the device's trusted certificate store. You could email it to yourself then tap on the attachment, or put it into iCloud Drive and open it from Drive on the phone. Then got to Settings and search for Trusted Certificates and go there to mark this certificate as trusted.
You might find it easier to just get a real cert for your server, such as a free one using certbot.eff.org
HTTPS request failed because of Error Domain=NSURLErrorDomain Code=-1202 only on iOS14.6
The problem is caused by go_daddy, certificate generated during 4.21.2021 and 4.27.2021 by go_daddy only contains 2 SCT log oprators, iOS14.6 requires 3 operators. Just ask go_daddy recreate a certificate and everything will be ok.
more info here:https://developer.apple.com/forums/thread/681207
Error Domain=NSURLErrorDomain Code=-1202 iPhone
It is device setting that need to change the date and time , and set it automatically ON for current time zone .
NSURLConnection finished with error - code -1202
Acc to Google Search -1202 = NSURLErrorServerCertificateUntrusted:
Help Links:
HTTPS with NSURLConnection - NSURLErrorServerCertificateUntrusted
NSURLConnection Error code (-1202,1012)
REF : Undocumented NSURLErrorDomain error codes (-1001, -1003 and -1004) using StoreKit
Check validity of certificate in server side also, as this can be one possibility for this error.
Also, NSURLConnection
is depecrated i suggest update it via NSURLSession
Disable HTTPS GET certificate check
add this entry to info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>server.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
and use the HTTP insteasd of HTTPS in URL
iphone: secure restfull server The certificate for this server is invalid
I feel this might be because of DNS, something like your server is not registered.
Try using this for development:
Create an NSURLRequest+NSURLRequestSSLY.h
file and add these lines to it
#import <Foundation/Foundation.h>
@interface NSURLRequest (NSURLRequestSSLY)
+(BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host;
@end
Create an NSURLRequest+NSURLRequestSSLY.m
file and add these lines to it
#import "NSURLRequest+NSURLRequestSSLY.h"
@implementation NSURLRequest (NSURLRequestSSLY)
+(BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host
{
return YES;
}
@end
And don't forget to remove it before publishing as your app might get rejected.
Related Topics
Clipstobounds Causes Uiimage to Not Display in iOS10 & Xcode 8
Calayer - Cabasicanimation Not Scaling Around Center/Anchorpoint
Swift 3: How to Add Watermark on Video? Avvideocompositioncoreanimationtool iOS 10 Issue
How to Dynamically Format a Number to Have Commas in a Uitextfield Entry
Uicollectionview Multiple Sections and Headers
Drawing Gradient Over Image in iOS
Getting a Thumbnail of a *.Mov Video iOS
Container View Getting Pushed Down as If It Had a Uinavigationbar
How Should a Swift + Objective-C Project Be Setup for Unit Testing
Change App Language in iOS Without Restarting the App
Google Analytics 3.08 iOS Idfa Class Missing, Won't Collect Idfa
Gem Native Extension Error While Installing Cocoapods
Xcode 4.3:Missing Icons for iOS Apps in Organizer's Archives
iOS 7 Device Token Is Different for Same Device