What is the best approach for building an iphone client for a rails app?

后端 未结 6 1467
感动是毒
感动是毒 2020-12-23 18:22

I have a fairly standard rails app and would like to be able to access the basic CRUD (Create, Update, Delete) operations as well as queries I have added, from an iPhone app

6条回答
  •  攒了一身酷
    2020-12-23 18:42

    Your best bet is to write a simple wrapper class around NSURLConnection that sets up the specific stuff for your API. It's not particularly complicated, and it lets you tailor your class's API directly to the REST API you're targeting. Your class can have an init method like initWithMethod:delegate:params: where the delegate is the object that wants to receive the result asynchronously, and the params is an NSDictionary of all the parameters. You can also use a property on the class to set up authentication (or have the class discover and record that itself after you log in).

    As for parsing XML, I'd recommend checking out TouchXML.

提交回复
热议问题