iPhone REST client [closed]

2019-01-10 06:48发布

问题:

Does anybody know is there any good library for iPhone SDK to call REST web service. I want to have something simple like Heroku rest client


Thx everybody for help.

My server side is on Rails so looks like ObjectiveResource feet best of my needs.

回答1:

In case your REST service is implemented in Ruby on Rails, the open source ObjectiveResource project is looking very promising. It has been working great for me in a relatively complex project of mine, and I've even contributed some code back to them.

ObjectiveResource



回答2:

I suggest using the excellent ASIHTTPRequest source from All-Seeing Interactive: http://allseeing-i.com/ASIHTTPRequest. I'm doing this, and so are several released iPhone apps, so you can be sure the code is pretty solid.

This is a wrapper around the CFNetwork API that makes some of the more tedious aspects of communicating with web servers easier. It is written in Objective-C and works in both Mac OS X and iPhone applications.

It is suitable for performing basic HTTP requests and interacting with REST-based services (GET / POST / PUT / DELETE). The ASIFormDataRequest subclass makes it easy to submit POST data and files using multipart/form-data.



回答3:

Hope Andrian Kosmaczewski's work can save your time from reinventing the wheels:

http://github.com/akosma/iphonerestwrapper/tree/master

And, it's Public Domain.



回答4:

Take a look at RestKit: http://restkit.org/ It provides an excellent API for accessing RESTful web services and representing the remote resources as local objects, including persisting them to Core Data. It's fully asynchronous and sports a lot of other slick features



回答5:

I created a blog article about doing this.

http://www.dreamfreeze.net/weblog/restful_webservices.html



回答6:

[akosma / iphonerestwrappert] try this wrapper from github

Caged / httpriot this is a very Simple HTTP Rest Library for iPhone and Cocoa projects.



回答7:

After using the super verbose and painful delegates that you had to until iOS 4, we moved over to using blocks for asynchronous behavior. it's been really great and has allowed our code to actually be readable lately.

We open sourced the rest client that we used here :

https://github.com/jeremylightsmith/RestClient

Let us know how it works for you.



回答8:

You can check your server response with a rest client app on iphone - http://itunes.apple.com/us/app/rest-client/id503860664?ls=1&mt=8

This can help you debug your code on server side.



回答9:

Using REST based services really doesn't need a "good library."

NSURLConnection and NSURLRequest, included in the SDK, are all you really need.