Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RestKit 0.2 Connect to Invalid HTTPS Security Certificate

In RestKit 0.2, how do I allow my app to connect to a server with an invalid https security certificate? From the AFNetworking documentation it looks like all I have to do is #define _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ . However, I've added that command to my pch file, to Build Settings > Preprocessor Macros, and to my App Delegate. All of which fail to allow the connection. Any ideas?

like image 785
dirkoneill Avatar asked Dec 03 '25 11:12

dirkoneill


2 Answers

It would appear that the only way to accept invalid certificates is to go to the RestKit subproject, go to Build Settings > Preprocessor Macros and add the value _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ . You then need to clean your project.

I'm guessing that because the RestKit subproject contains AFNetworking some sort of pre-compilation is going on that cannot be reversed in your main project. So if you have the flag in the RestKit Build Settings, RestKit will compile with support for invalid certificates. Otherwise, by default, it will not.

like image 83
dirkoneill Avatar answered Dec 06 '25 05:12

dirkoneill


Choose the Pods project > Build Settings > Preprocessor Macros and add _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ to the Debug entry.

like image 21
Swati Ardeshna Avatar answered Dec 06 '25 06:12

Swati Ardeshna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!