开发者

Integrating iPad/iPhone App with Rails Application

I'm a student working on a project where a need to integrate my iPad (or iPhone) ap开发者_如何学Pythonplication 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!


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.


The simulation crashed because of this bug: https://github.com/yfactorial/objectivesupport/commit/a3c7a6b5765cb2695712c832c9bca9d8fd6a6898

If you get the source from git, you will be able to run the demo without error, otherwise, you can change the code (1 line) as indicated above

Good luck!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜