A vexing problem that the iOS SDK does not really help us is how to give users access to the data that is stored in their apps. This is so important because users want to be able to take control of the content they create with our apps. Perhaps because of the closed sand-boxed nature of iOS we cannot easily do this.
Why Would Users Want To Do This?
There are three main reasons that users want this (believe me I can give you a hundred emails asking for this capability).
Even though iTunes provides a backup it is not transparent enough to be helpful for most users. It is way to easy to overwrite data when you remove an app. Most users don’t even know this function exists or how to restore their app data.
Users want to be able to make sure their data is “safe” and that they can get it back if the worse happens.
Some users want to be able to share their content. They put the work in to generate their content so naturally they have a right to use this content any way that they see fit. Simply storing their data in the app’s documents directory will not allow them to do this (at least not without intervention from us).
These days people have apps running on multiple devices: iPhones, iPads, Android phones, Macs & PCs. People may also want to start using a completely different app or an upgraded version of a current app. Without freeing the user’s data there is no way for them to do any of this without starting over (which means they will ditch your app or just not do it at all).
What Are Your Options?
To give your user’s all that they want it terms of access to their data on iOS you only have one realistic option: remote data hosting. By this I mean a web service that you create or some type of file storage solution like FTP hosting or Amazon S3. Here are some solutions that I have thought off:
By this I mean creating your own web service that goes with your app suite. This is something that you would need web hosting and a system created with a platform like PHP or Ruby On Rails. This is probably the best option if you are creating something that you would like to stay in control for a long time and you will use with multiple platforms (desktop, mobile & web).
The two real downsides to this are that it is simply a lot of work and you will need to commit to keeping this service running for the long haul. This means writing code and making sure servers are up and all of that. This may be overkills for simple apps that just need a decent backup solution.
FTP File Storage (Your Server)
This is a more option where you can simply store the user’s data on your own server. You will not need to create a web service per say just give them an ability to save their content on your server. To do this you would need some kind of scheme to protect their data and make sure they are using the correct files.
That downside to this is that using FTP with iOS turns out to be a very difficult and frustrating experience. You can certainly find examples but I’ve yet to really get a decent example working. This solution also has the same problem as the web service in that you must maintain the servers and make sure they stay online.
An alterative is using Amazon S3 to host your user’s content. Amazon does provide a web service interface but not much in the way of support for the iOS SDK. At least you don’t need to worry about keeping the server up and accessing REST web services is pretty straightforward with iOS.
FTP File Storage (Their Server)
This is the same solution as above but using the user’s own FTP server. Of course, this is limited to sophisticated users who have their own hosting accounts or maybe something from their Internet provider. I don’t recommend this because I just think it will lead to way too many customer service emails where you find yourself trying to help people understand/setup FTP.
What’s The Alternative?
While some of the options above may appeal to your situation they all are pretty high maintenance. Something that I have been trying really simplifies this problem and while it may not offer quite as many options as rolling your own web service it pretty darn close and super easy to use. This is DropBox.
What Is DropBox?
DropBox is software that syncs your files online and across your computers (and apps). Anyone can sign up for a free DropBox account (2 GB) and store files on the DropBox server. These files will be available from any computer and any mobile device with an app that supports DropBox. DropBox has created a website for users as well as free iPhone and iPad apps that user’s may use.
But what is really special about DropBox is that have created an API (web service) that developers can use to add DropBox support right in their apps (including iOS, web apps, Android and any desktop OS). iOS developers get extra special treatment because the DropBox team has created a SDK where they basically give you everything you need in normal Objective-C code. Here is an example of how easy this code is:
[self.restClient loadFile:[NSString stringWithFormat: @"%@/%@", dropBoxFolder, textFileName]
Something else that I really like about DropBox is that you do not need to worry about maintaining any servers yourself for your users. This has always been the prohibitive cost for me: I just don’t want to commit to keeping a server up 24/7.
How To Use DropBox In Your App
This is pretty simple: you must have a DropBox account (free) and you will also need to register an app (free but they review this so it takes a day or two). Once you have an approved app (you don’t need to implement it just fill out a form on their website) you will need to provide a consumer key and secret from your app delegate.
The next step is to download the DropBox SDK, import the files (you get all the source code), add the security.framework (under your frameworks group folder) and then you are ready to use the API. Some of the things that you can do include: getting the user’s folder and file information, downloading files and uploading files. That is really all you need but there are some more things available to you.
DropBox Demo App: Online Text Editor
As a demo app I have an online text editor to see how this all works. What this app does in link up to DropBox. The app uses your own credentials to log into your DropBox (they provide a secure form for you to use). Then you can download your text file from the web (second toolbar button), edit the note by touching the screen and typing. You must click the “Done” button to save the updated text file to a temporary directory on your iPhone. Once you do that a user can touch the “Save” button to upload the new text file to their DropBox.
Once you do this you can open the file on your desktop (if you installed the DropBox software) or just with a browser or any other app that can access your files. You can even edit using a text editor! Your data is free!
DropBox App Ideas?
Let’s start a conversation: what could you use this capability for in an app? If you know my app business you can probably guess why I’m interested but there are tons more ideas I can think for this API…