开发者

Communication between iPhone App and Rails App

What is the best way to communicate between an iphone app and a rails web app? I need to be able to register as a user, edit my profile and upload, rate and comment images in the rails web app.

In my rails controllers I have a lot of stuff (logic), I don't need when communicating with an iphone. How can I separate the logic for the iphone and the web in my cont开发者_如何学Croller? Should I use separate controllers for web and iphone communication?

What's the best tool/framework on the iphone to exchange data and images with a rails app? I looked at ObjectiveResource, but I'm not sure if it will to the trick (including image uploads).


I think it works nicely to have an API directory with a set of controllers that define your API.

So you'd have, for example /app/controllers/api/items_controller.rb and a /app/controllers/api/base_api_controller.rb

Inherit from your BaseApiController instead of ApplicationController, and you can get your api token from there, etc.

In your routes:

namespace :api do
  resources :items
end


Take a look at this presentation :) http://www.slideshare.net/sujee/iphone-clientserver-app-with-rails-backend-v3

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜