0

How can I disable the certificate validation when I make request with RKObjectManager ?

Because I'm getting this error : The certificate for this server is invalid. You might be connecting to a server that is pretending to be “the web service address” which could put your confidential information at risk."

Thank you !

Duplicate question : I want to allow invalid SSL certificates with AFNetworking

Community
  • 1
  • 1
Aladdin Gallas
  • 701
  • 2
  • 12
  • 36

2 Answers2

1

If you are simply doing some tests against some server with the certificate misconfigured you can compile with the preprocessor macro _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ defined, and the request will bypass the certificate check.

I do not recommend that approach for a production server. If a production server has a misconfigured SSL certificate, you should try to fix it (if you can) or inform the owners of the server to fix it.

yonosoytu
  • 3,319
  • 1
  • 17
  • 23
0

if you are using RestKit using

client.allowsInvalidSSLCertificate = YES;

won't work, instead do this:

if you added rest kit manually to your project, click on RestKit.xcodeproj go to project > Build Settings > Preprocessor Macros

and add _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_=1

thats finished.

Hashem Aboonajmi
  • 13,077
  • 8
  • 66
  • 75
  • 1
    But you can use `objectManager.HTTPClient.allowsInvalidSSLCertificate = YES;` instead. – anka Dec 29 '14 at 13:49