Titanium Community Questions & Answer Archive

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

HttpClient - Unrecognized selector sent to instance

I have an Android app that works perfectly and am trying to port it to IPhone, however am having some serious issues. One of the issues is that whenever I make web service calls using the httpclient it errors out and crashes the app:

wNCSFNumber stringByreplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance

My httpclient code is fairly standard, what am I missing?

var loader = Ti.Network.createHTTPClient();
    loader.onload = callbackFunction;
    loader.onerror = ajaxError;
    loader.open("GET", url);
    loader.send();
— asked November 15th 2010 by Justin Toth
  • iphone
2 Comments
  • I would suggest you post the code to your callback functions. This code look harmless so the problem is not here

    — commented November 15th 2010 by Aaron Saunders
  • The callback function doesn't get called, I tried adding logging as the first line of the callback function and it never gets hit. However, all it does is take this.responseText and evals it (it's json that it would return) and then uses the evaled object.

    — commented November 16th 2010 by Justin Toth

1 Answer

  • Accepted Answer

    did you put logging in onload AND onreadystatechange? there is a bug that requires you to have onreadystatechange defined i think

    onreadystatechange
    

    See this Question, about halfway down the page

    — answered November 16th 2010 by Aaron Saunders
    permalink
    0 Comments
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.