Domain=NSURLErrorDomain Code 1202
For the devs who are working with a server locally and need to get the iOS Simulator to trust the certificate. Follow the steps below:
Get the
.cer
file by exporting the certificate from the Keychain. You need the certificate file in a valid format and its easiest to get this byexporting it from the Keychain.Drag and drop the aforementioned
.cer
file onto the simulator. It should give you a prompt on installing a "Profile". Go ahead and follow the instructions to install it.For those who are working with the latest versions of XCode and iOS Simulator. You need to do 1 last step. The Simulator must be explicitly told to trust the root CA. Do this by going to
General -> About -> Certificate Trust Settings -> "Enable Full Trust for Root Certificate" for your particular certificate
Hopefully, this saves headaches for some people!
It took a lot of time for me to find a fix for this:
If any of us ran across the certificate issue,.It is because of antivirus preventing iPhone simulator to browse any websites.I was able to fix this issue by the following steps:
- uninstall or turn off Antivirus in Mac.
- erase all content and settings of simulator.
- restart mac.