I couldn’t decide what to title this post, so i’m giving you choices:

  • Apps that sync
  • Apps, Dropbox, YAMLKit, and power users
  • Dropbox + YAML + Syncing apps = Happy power users
  • Please use Dropbox + YAML and make your App sync
  • My Syncing Apps Manifesto: Dropbox + YAML = Awesome

Anyway, here’s my point: Too many iPhone apps have reviews with a common complaint: It’d be great, if only it would sync.

You see, there are a lot of people these days who have more than one iDevice. Here’s a common situation: Jim has an iPad which he uses at home, an iPhone which he uses on the train to work, and a Mac/PC at work. He’d love to use the same app on all of those, with his data synced elegantly.

Dropbox vs iCloud

Day one gets it right with their diary app: everything is synced to iCloud or Dropbox, there are different versions of the app for iPhone, iPad, and the Mac, and they all work to the strengths of each platform. Eg you can type on the Mac/iPhone, and read on the iPhone, or even take short notes on the iPhone. And using Dropbox is great – I can see the files on Dropbox, they’re not hidden away from me, i feel like i’m in control. I can back them up as I see fit, I can read them (kind-of), or really do anything I feel like. Plus, as of the v1.0+ Dropbox api, you get access to only tidy folder inside Dropbox/Apps to put the files for your app, which will put your users at ease. One last opinion: I think Dropbox is the best ‘cloud-y’ way to bridge the data divide between desktop (explorable file system) and mobile (no visible file system).

iCloud is a bit less awesome (to me) in this respect: the files are tucked away ‘in the cloud’ where you can’t see or touch them easily outside the app. I guess this is ideal for a consumer grade app, but for a power user this is a bit disconcerting. We all like to feel like we’re in control, which this approach (for me, at least) lacks. Plus it locks you to the Apple ecosystem AFAIK, and what if you wanted to make a PC version of your app?

My ideal syncing app

Here’s my ideal solution: the files to your app are all tucked away in a certain folder (eg: /Apps/MyApp) in Dropbox, and all the apps do a 2-way automatic sync between this and their local storage at startup/shutdown/change events. These files are all in some human readable format: YAML, JSON, or (shudder) XML. I personally prefer YAML because it is very human-readable for powerusers who like to open these files in a text editor. Also, because it is full of awesome (IMHO). However, i’ll understand if you prefer JSON or Plists or XML – that’s just my preference. In case you haven’t seen JSON, here’s how it looks:

id: 201327 name: Some Name hue: 300 icon: 248-sign some_array: – First – Second – Last

I’ve tried to follow this approach with my Service History app, and will use it in all my future apps where this kind of data sharing is appropriate. I also open-sourced the 2-way-syncing code, which is fairly simple and easy to integrate into your app, please check it out: CHDropboxSync.

One pitfall i’ve had with this solution was a user who contacted me, saying that when syncing one time the app deleted their data off their iPhone, rather than pushing it up to Dropbox. Now i can’t say for sure what happened in this situation, it’s impossible to know, but I think a nice solution would be that whenever the sync detects a remote delete, it should move the local file in a ‘Trash’ folder, and provide a UI for the user to restore files on a one-by-one basis if they want, just in case some bugs slipped through the radar. I’m planning on doing this with CHDropboxSync one day. Maybe for my current app-in-progress (a password syncer).

YAML

I’m a bit fan of YAML. I think it’s the only serialisation format that is optimised for readability. JSON is pretty close, but let’s be real here: it’s only readable to us devs, your average Joe is going to run away scared. YAML is so good, i’ll bet you could use it to serialise your monthly sales data, print it out verbatim, and give it to your CEO and he’d happily read it. Sometimes we devs need to get out of the ivory tower, I think. Use YAML, it’s friendly, people will love it.

One fair criticism is that it’s a bit difficult to find a good YAML library for ObjC. I recommend YAMLKit + libYaml. I tried YAML.framework, but it serialised in UTF16 which ruled it out for me. YAMLKit is a winner – it’s as simple as follows:

Read a yaml file into an NSDictionary:

NSDictionary *d = [YAMLKit loadFromFile:@“/Some/Path/To/My/File.yaml”];

Write an NSDictionary to disk in yaml format: [YAMLKit dumpObject:myDictionary toFile:@“/Some/Path/To/My/File.yaml”];

I’d really love a free YAML reader for mac to magically appear and make it’s way onto the app store, with a file association to the YAML file type. Imagine the feeling of ‘Oh sweet, I’m peeking behind the curtain, I can see my data, it’s readable and accessible’ when you user is poking through their Dropbox, finds the files to your app, double clicks one and it opens in textedit or a nice YAML visualisation tool. It’d be so empowering. I know I’d love it.

Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.

Chris Hulbert

(Comp Sci, Hons - UTS)

Software Developer (Freelancer / Contractor) in Australia.

I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!

Get in touch:
[email protected]
github.com/chrishulbert
linkedin



 Subscribe via RSS