Search code examples
iphonesslrestkit

Mixing http and https in RestKit


I have an RestKit-enabled app which makes HTTP GET calls and should make HTTPS POST calls, to protect user data that otherwise would get sent unencrypted. As far as I know, it's possible to set the RestKit framework to either use unencrypted HTTP or SSL-encrypted HTTPS for the entire app by simply setting the base URL to the desired url.

In my case I need to have both. How can I switch between HTTP and HTTPS in RestKit? Is this even possible?


Solution

  • You'll need to use two instances of the RKObjectManager - one for the HTTP GET calls and one for the HTTPS POST calls. Keep in mind to call each manager with the given name and not using [RKObjectManager sharedManager] any more because it's set to the first initialized RKObjectManager.

    As an alternative you can set the Base URL of the given RKObjectManager before each GET/POST call.