Storage Issue with iOS-5 And iCloud;

Posted on Updated on

Hello everyone ..

Now a days, we are noticing that many people are getting rejection from AppStore due to storage issue; I looked into this issue and here are my findings regarding iOS-5 and iCloud;

When we install our application in device, we have three main directories in our application space

  • <Application_Home>/Documents
  • <Application_Home>/Library/Caches
  • <Application_Home>/tmp


Applications normally store their data in /Document directory and everything work normally; Applications can also store their temporary data in /tmp and /Library/Caches directories, and it get deleted when user uninstall the app form device; Apple accepted such applications in past who stores application specific data, as well as downloadable contents in /Document directory; Examples are magazine app etc;


In iOS 5, the iCloud was introduced; It keeps user’s applications and data synced among different devices; In actual, iCloud sync everything that present in /Document directory for an application; As this data may be in large size (includes downloadable contents) Apple now start rejecting such apps which stores their data in /Document directory, by saying that as iCloud backups are performed daily over Wi-Fi for each user’s iOS device, it’s important to ensure the best possible user experience by minimizing the amount of data being stored by your app. In addition to purchased music, apps, books, camera roll, and device settings, everything in your app’s home directory, including its Documents folder, is backed up to iCloud.

Many developers store all of application’s data in /Document directory; So due to iCloud issue, the option of storing our data at this place has been eliminated;

The alternate was /tmp and /Library/Caches directories, as we all knew that they are intact by iCloud and OS; But in iOS 5, there’s an important change with these two directories –the only two directories that aren’t backed up — are now “cleaned” out without any notification or alert to user, when the device is low on space; If someone have never observed files being removed from these directories in the past, that is not a guarantee that it will not change in the future. Especially when the change is in accordance with documentation;

So at this point, all possible places are not reliable to store downloadable data;

  • using /Document directory will surly lead our app to rejection;
  • Cache and/or tmp directories are afraid of being cleaned out at anytime if device has low storage space; Worst aspect is user won’t be notified for both low storage and for cleaning process;

Apple suggest two possible solutions for this issue;

  • Mark the files “do not backup” if you dont’ want your file to be backed up by iCloud;
    Issue: This may be a possible solution but this flag is available from 5.0.1; Not even in 5.0; 
  • Your application should store all downloadable data in Cache or tmp directory, and keep watching them keenly if some important data is deleted by OS; In such case, user should ask to download them again;
    Issue: But even with available, fast, unlimited internet connectivity, randomly deleting an app’s data is still a problem; User may feel annoy by downloading the content time and again;

What I did with my application is

  • Start storing all downloadable contents in /Library/Cache
  • For existing users, I moved all their contents from /Document to /Library/Cache;
  • /Document directory has now only a database file (which is treated as application specific data) All downloadable contents has moved to /Library/Cache;

Here are two links that discuss the whole story in a very nice way;

First read http://www.marco.org/2011/10/13/ios5-caches-cleaning
and then http://iphoneincubator.com/blog/data-management/local-file-storage-in-ios-5

If anyone has more info on this topic, kindly share;

Advertisements

3 thoughts on “Storage Issue with iOS-5 And iCloud;

    Bruce Cichowlas said:
    February 24, 2012 at 16:32

    This does seem quite serious, especially to those of us whose applications use large amounts of paid-for, downloadable content because of their nature. It seems a special problem for those whose iPad applications are intended to be used mainly offline.

    Surely there must be many developers facing this issue. Do you know what approaches they are taking?

    Bruce

      Ans responded:
      February 24, 2012 at 17:04

      There are two possible ways to get ride of this issue; First is: Move all of your downloadable contents to Library/Cache; But issue is if user is offline (while flying to/from different states) then deleting his/her contents will surly lead to very unhappy situation; Second solution is use “do not backup” flag with your contents, present in /Document director; It will prevent them to be backed up with iCloud; But I’m not sure still if Apple accept this approach and accept the application having heavy data in /Document directory; I used the first approach; Add a routine which moved all existing contents to /Library/Cache directory, and turned every next download to Cache, not /Document;

        Bruce Cichowlas said:
        February 24, 2012 at 18:24

        In my case, it is specially modified versions of licensed audio songs that are involved. The user purchases these one by one and might have a dozen or more. Each is anywhere from 2MB to 30MB. They would be very disappointed if they had paid for their purchases and then tried to use them offline and found them missing, for instance within a car on an iPad that did not have 3G. So I suppose the second solution is perhaps best for me, though it would presumably mean that I’d have to requiring or at least recommending 5.01. And from what you said, my data would still be susceptible to unexpected deletions if space were at a premium. (And how many of us haven’t loaded devices to near memory capacity?)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s