ruby on rails server application with iPhone / Android IOS client? best practice how to begin...

Very interested in IOS and perhaps later Android client that connects to my ruby on rails server app.

What are good resources, books, tutorials, blogs to check and dive in as a ruby developer want to develop a simple client to begin with, who has experience on this topic and can share some insights?

In the basics my IOS client will be a client for the rails app wich is in basics just a simple social media site with just profiles and images I would like to list, later on I want to add messaging but for now get the basics and learn how this should work.

I have a bit of knowledge of objective C and a little bit of experience with Xcode and the basic principles, So I’m not a total Newbie on this. Whats so unclear is how to “Connect” Rails app <–> IOS client.

  • Advised is not to use general rails app controllers(?) so you write a set of “iPhone” controllers instead?

  • Are there any write-ups on how to start with Xcode for connecting it to a rails app?

  • Books, Ebooks, Blog posts anything to get you started?

  • Commercial "starter kits or screencasts to buy to get you up and running fast based on professional best practice methods ? "

  • You use JSON / XML to communicate?

  • For login I use devise, heard its hard to implement in IOS clients ( In basics I will leave login out )

Any other thoughts on this matter? Would love to learn how to write a cool IOS client for my Rails app.

Hope someone can get me and other future newbies to this matter on “Track” :wink:

Probably the easiest way to communicate with your rails app from iOS is to use regular http requests. I haven’t used json, but I’ve seen Objective C libraries for parsing json, so that’s an option. It’s also very simple to create plists for use with [NSDictionary dictionaryWithContentsOfURL:url] (keep in mind that is a synchronous call, meaning your iOS app will not respond while the request is handled; Cocoa contains asynchronous commands as well but that’s definitely more advanced). The ability to specify a format for a request and use the appropriate view could make this simple to do in your existing controllers as well, although if the flow of your data will be completely different it’s also easy to set up an api controller.

I’ve only handled HTTP 401 authentication in iOS, but that is very simple with the NSURLCredential class. A quick glance at the Devise docs indicate it has support for 401 basic and digest authentication.

http://allseeing-i.com/ASIHTTPRequest/ is tried and true
http://restkit.org/ is only slightly less so

iOS 5 added NSJSONSerialization - http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html

Which is nice.

Those bits should cover the glue. there are other options, of course.

TJ