Problems with ASI-HTTP and ARC in iOS 5 #20

Closed
scarer opened this Issue Oct 24, 2011 · 24 comments

4 participants

@scarer

I was wondering whether there were any plans to upgrade the use of ASI-HTTP in this code as if you read the posts here http://allseeing-i.com/ the maintainer of ASI-HTTP is not going to continue develop.

Also, if you do try to compile ASI-HTTP using ARC in iOS 5 you will receive a stack of problems. There are workarounds for this, but seeing as though ASI-HTTP is not going to be developed anymore, is there any intention of upgrading to new APIs in iOS 5?

@kylebrowning

I havnt decided if Im going to switch to another Request mechanism or write my own. I may even fork ASI HTPRequest and maintain a copy specifically for DIOS.

What are your thoughts?

@scarer

From what I've read online (if that's anything reliable at all), it is possible to use NSURLConnection in iOS 5 for achieving the same outcomes but there are still ways to alter the ASI-HTTP request stuff so it works if you're using ARC (pokeb/asi-http-request#210).

ASI-HTTP is very popular so it'll be interesting to see if anyone takes over the project and re-writes it or creates a branch that's ARC compliant and freely available.

@scarer

This looks promising http://mobile.tutsplus.com/tutorials/iphone/restkit_ios-sdk/ haven't tried it yet.

@markdorison

If large changes are going to be made to replace ASI-HTTP, it would be great if it was an asynchronous solution. The code currently makes synchronous calls and when dealing with objects that are not thread safe (like much of Core Data), and it is not possible to simply detach to a new thread. There are solutions (I used an NSOperationQueue), but it would be greatly simplified if it was made to be asynchronous out of the box.

@kylebrowning

Yeah Mark, thats in the plans, but alas no time currently. :(

@markdorison

Totally understand. Just wanted to put it down here so it is on the radar.

@kylebrowning

How do you like the looks of this? https://gist.github.com/70fbec972e62000b2680

Also notice, I'm not releasing anything because I have removed ASIHTTPRequest and replaced it with AFNetworking, this allows us to be ARC compatible if we disable ARC for the AFNetworking files.

And were now truly asynchronous so hopefully this cleans everyones code up a bit.

@markdorison

This looks promising. Exciting stuff!

@jefflinwood

Hey good to see that the DIOS SDK is now using AFNetworking and working async.

I've had no problems using AFNetworking with ARC. I'm using blocks for my request success and failure methods - seems to be pretty clean.

@kylebrowning

Im gonna commit it pretty soon, i just cant get the last remaining piece of file save, and attaching a file to a node. Its gonna require a patch to services, but its worth it to be able to attach a file to a node for a specific field and we dont have to BASE 64 anything anymore.

@jefflinwood

Cool, are you sticking with plists, or going to JSON?

@kylebrowning

both continue to work and now its much more simple to switch between the two.

@jefflinwood

I didn't know DIOS SDK worked with JSON before. Cool!

@kylebrowning

i spent like an hour porting to the JSONKit but i never committed it, It was really easy to do though. At any rate this next version will be a lot simpler.

@kylebrowning

Its a work in progress. not finished yet, but you can start playing with it and making suggestions, or even help flesh out the Taxonomy stuff and file stuff. I also need to get on top of views. Ugh, so much to do. so little time.

@kylebrowning kylebrowning added a commit that referenced this issue Mar 16, 2012
@kylebrowning kylebrowning attaching to ticket #20 344083d
@kylebrowning kylebrowning added a commit that referenced this issue Mar 16, 2012
@kylebrowning kylebrowning attaching to ticket #20 1a68d14
@jefflinwood
@kylebrowning

You can only have one delegate for a session, but, you can instantiate multiple DIOSNOde, or DIOSUser, ands et different delegate based on the instantiation.

If you wanted to get me started on one of them I can do it for the rest, but for right now, this works, and I dont really have time to change it before my speech on Tuesday.

@kylebrowning

Id be happy to do it if I saw an example of it, so maybe just fork it and update one of the objects and the documentation..

@jefflinwood
@jefflinwood

I went ahead and implemented a DIOSView object using blocks instead of delegates.

Gist of DIOSView.h,DIOSView.m, and sample code from MapViewController.m - https://gist.github.com/2061788

For reference, here's the rest of that app (no DIOS SDK though) - the only thing I changed was to add the DIOS SDK 2.0, and then took out my AFNetworking code and replaced it - https://github.com/jefflinwood/Drupal-Map-App-for-iPhone-and-iPad

@kylebrowning
@jefflinwood

I actually did that code on the flight out to Denver this morning :)

Let me know if you want any help!

@kylebrowning

Fixed in latest dev pushed to master, and taged 2.0-1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment