ASIHTTPRequest alternative
Asked Answered
S

3

5

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?

Slone answered 5/5, 2011 at 11:3 Comment(3)
NSURLConnection developer.apple.com/library/ios/#documentation/cocoa/reference/…Pyroelectric
Yes, i can use that. Thx for the adviceSlone
ASIHTTPRequest is now deprecated. You might want to look at the FSNetworking library that Foursquare released as a possible alternative.Adlar
B
9

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
Burris answered 17/7, 2012 at 12:13 Comment(0)
G
6

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.

Gauffer answered 5/5, 2011 at 13:42 Comment(1)
Thanks, i appreciate your help. I will recheck my code, however i already put much effort into bug tracking and did also several tries with resetting the delegate to nil with no luckSlone
S
5

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).

Shelly answered 5/5, 2011 at 16:3 Comment(1)
Thank you, i'll try the wrapper if ASIHTTPREQUEST still doesn't work for me. I use the server-client communcation for authentication and text/images as dataSlone

© 2022 - 2024 — McMap. All rights reserved.