views:

63

answers:

1

Hi all,

I'm a student working on a project where a need to integrate my iPad (or iPhone) application with a Rails Web App, populating the database from the iOS side and displaying the contents in the web app. I've found ObjectiveResource, but I've had difficulty getting it up and running (went through the getting started, and had the simulation crash on me after attempting to save the new entry). This would be an application running on an intranet with pretty mild database requirements. I apologize if I've missed something obvious, I'm somewhat new to both iOS programming and rails. I'd really appreciate any advice or direction, or even a better approach to the problem if one should exist.

Thanks!

+1  A: 

I'm not a Rails guy - but I assume there is an obvious and easy way to do this in Rails, as I've done a billion times in Perl (and a few in PHP). I'm biased, but this is the way I do it:

  1. Have Rails read the pertinent info from your server-side DB - and spit it out in XML format. This probably requires a very minimal amount of Rails coding - as in my Perl scripts - this can be a simple as calling "mysql" with a query - and requesting output in XML format (which the MySQL CLI client app can natively do itself).

  2. Have the iPhone app use NSXMLParser to retrieve and parse the XML data from the web site. This is done with NSXMLParser's - (id)initWithContentsOfURL:(NSURL *)url method to fetch the data from the web. The data will be retrieved and can be parsed by other members of this class.

  3. Do whatever you want with the data.

Brad