ASIHTTPRequest alternative

I am using currently ASIHTTPRequest for communicating with the server, however it's causing crashes. The bug is known for a long time, but is still an issue.

Therefore: Are there good alternatives to ASIHTTPRequest? I am flexible on the server side, i could also use sockets or using something else. What would you recommenend for server client communication?

Answers


Here is the link to the topic where the author is giving some ASIHTTPRequest alternatives.

List of them with links from topic:

  1. AFNetworking
  2. LRResty
  3. RestKit
  4. AWS SDK for iOS
  5. ShareKit
  6. NSURLRequest/NSURLConnection

I know it's probably not the answer you are looking for, but if ASIHTTPRequest is crashing then it's at least 90% likely that there's an error in your code - the most common problems all relate around request vs delegate lifetime issues. NSURLConnection might well just give you a different set of problems (though it might just work well). NSURLConnection also has a lot fewer features (no caching etc).

Generally, you need to remove the delegate from ASIHTTPRequest before the delegate is destroyed (ie. at the very start of the delegate's dealloc method). So long as this is done, there is no way for ASIHTTPRequest to call a deallocated delegate. You must do this for every request, including ones that have been cancelled.

The bug you link to seems to relate to one very particular circumstance, and at least a one reason it's not been fixed is that it appears no one else has been able to reproduce it.

(I'll caveat this with the statement that their have been problems with ASIHTTPRequest in the past - in particular the release of v1.7 contained some race conditions that could cause crashes, but these were later fixed in the git tree. I've not personally tried v1.8, but v1.7 with the fixes is working very well for me.)

It might be worth posting a new question detailing the crash you're seeing and sharing some of your code / how you use ASIHTTPRequest.


ASIHTTPRequest is pretty popular and used by a good number of applications so, as JosephH suggests, it's more likely that there's a bug in your code.

Having said that, if it is in ASIHTTPRequest then it's open source -- you can fix it. I'm sure the maintainers would appreciate a patch. A BAD_ACCESS is likely over-releasing memory.

It's difficult to suggest an alternative since you don't say which features you're using. You could just use the native NSURLConnection if you're just using the basics (I wrote a thin wrapper around it and I'm sure there are a bunch of others out there). At the other end of the spectrum, there are REST libraries that integrate with Core Data too (RESTKit).


Need Your Help

Calculate p values based on differences between bootstrapped 95% confidence intervals

confidence-interval statistics-bootstrap p-value

I have bootstrapped model fits to some data from different three groups, using the 2.5 and 97.5 percentiles to generate a 95% confidence interval.

Create a weekly timetable using matplotlib

python numpy matplotlib

Edit: I changed Data Type to Pandas DataFrame that looks like this (datetime.datetime,int) in order to make the problem more simple.