Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

HTTPS based webservices

As posted in http://developer.appcelerator.com/question/50741/https-based-webservices , I am using webservices for my app.

myHttpClient.validatesSecureCertificate = false;
given by Goran Skledar worked liked charm in android (thnQ!).

But when I added myHttpClient.validatesSecureCertificate = false for iPhone, it doesn't work, it works well if I do NOT add that one line code.
Is it recommended to have myHttpClient.validatesSecureCertificate = false for production when submitting my app for review? Or should I just go ahead without adding it?

Error that I get: error = "Error Domain=ASIHTTPRequestErrorDomain Code=1 \"A connection failure occurred: SSL problem (possibly a bad/expired/self-signed certificate)\" UserInfo=0x7a5e5c0 {NSUnderlyingError=0x7a59070 \"The operation couldn\U2019t be completed. (OSStatus error -9807.)\", NSLocalizedDescription=A connection failure occurred: SSL problem (possibly a bad/expired/self-signed certificate)}";
source = "[object TiNetworkClient]";
type = error;

— asked August 11th 2010 by sudhi seshachala
  • https
  • iphone

4 Answers

  • @Matthias, Thanks for that reference.

    I was trying to connect to an https source with an expired certificate. The validatesSecureCertificate property wasn't helping me on my iOS 5.x simulation, but adding the code below, made it work like a charm.

    Just adding my thumbs up here, should anyone end up in this thread, with a smiliar issue as I had.

    var client = Ti.Network.createHTTPClient({
        validatesSecureCertificate: false,
        tlsVersion: Titanium.Network.TLS_VERSION_1_0,
    — answered May 22nd 2012 by Wouter Van den Bosch
  • What version of titanium mobile are you using, what platform. I had some issues with https but from 1.4.1 it works fine.

    — answered August 12th 2010 by Marko Perutovic
  • I gave this response on a previous post, but I think it applies here as well:

    I can't speak for 1.5.1, but in 1.7.1 with iOS SDK 4.3, I had to not use the validatesSecureCertificate property because it would fail on the device. By leaving this property out, I was able to get the connection to work in iOS; however, it would then fail in Android. I had to write OS-specific code to check the device and then determine whether or not to use the property based on what the device was. I am assuming this is a bug in Titanium.

    — answered July 6th 2011 by Michael Szul
  • I found something on JIRA:

    See: [TIMOB-2801] - iOS: HTTPClient intermittently errors on HTTPS requests


    Maybe this bug affects you.

    — answered April 8th 2012 by Matthias Fliegner
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.