← Back to Upcase

iOS on rails applications that can run offline


(Tamas Erdos) #1

Would your recommend using iOS on Rails as a framework for an app with the following characteristics?

  • Primary users will be on iPhones
  • Primary users will sometimes not have access to internet
  • Backend users will be on desktop
  • Will need to generate pdf reports for users
  • Complex app with layers of organizations & users with roles
  • Will need to accept payment (mostly on backend sites)

I’ve been playing around with Meteor.js and I like its syncing capabilities, but I’m much more familiar with Rails overall and also feel that iOS on Rails would allow me more flexibility. Biggest concern is the duplicate local / web database and syncing.

What approach would you recommend?

Thank you,
Tamas


(Geoff Harcourt) #2

Hi @Tamas_Erdos,

I’ve been dealing with this on my company’s application recently. Most of our users are viewing the app on a mobile phone, and they are often in building basements with spotty WiFi.

There’s a fork of rack-offline that works reasonably well with Rails 4: https://github.com/pascalw/rack-offline

I’ve also been using jquery-offline to cache API responses: https://github.com/wycats/jquery-offline

jquery-offline has a really cool system for working with cached content, but yesterday we found a bug with it where bad server responses can sometimes result in garbage data getting stuck in the cache. I spent most of yesterday rolling my own new version of the library, and I’m hoping to open-source it after a couple weeks of evaluation. One other potential issue with jquery-offline is that it uses the old style of jQuery Ajax responses (no promises), so it’s hard to construct clean callbacks with it the way you can with jQuery’s deferred/promise system (implemented in 1.5 or 1.6)

Both rack-offline and jquery-offline, which are written by the famous and very smart Yehuda Katz (of Rails, jQuery, Ember, and Skylight.io fame), have a significant attached risk, which is that now that Yehuda has moved on to Ember, both libraries haven’t been updated in over 18 months. I think this is a bigger problem with jquery-offline than rack-offline (which as long as you’re using the Rails 4 branch seems to work well), but it’s important to know that if you encounter issues it’s likely going to be up to you to fix them.

Let me know if you find anything in your own research, as this is a problem we’re thinking about a lot right now at my company.

-Geoff