{"id":3162,"date":"2012-02-02T10:55:39","date_gmt":"2012-02-02T05:55:39","guid":{"rendered":"http:\/\/aasims.wordpress.com\/?p=3162"},"modified":"2025-04-27T19:12:49","modified_gmt":"2025-04-27T19:12:49","slug":"storage-issue-with-ios-5-and-icloud","status":"publish","type":"post","link":"https:\/\/aasimnaseem.com\/blog\/storage-issue-with-ios-5-and-icloud\/","title":{"rendered":"Storage Issue with iOS-5 And iCloud;"},"content":{"rendered":"<p>Hello everyone ..<\/p>\n<p>Now a days, we are noticing that many people are getting rejection from AppStore due to storage issue;\u00a0I looked into this issue and here are my findings regarding iOS-5 and iCloud;<\/p>\n<p>When we install our application in device, we have three main directories in our application space<\/p>\n<ul>\n<li>&lt;Application_Home&gt;\/Documents<\/li>\n<li>&lt;Application_Home&gt;\/Library\/Caches<\/li>\n<li>&lt;Application_Home&gt;\/tmp<\/li>\n<\/ul>\n<p><!--more--><br \/>\nApplications normally store their data in t<strong>he<em>\/Document<\/em><\/strong> directory and everything work normally. Applications can also store their temporary data in\u00a0<em>\/tm<\/em>p and\u00a0<em>\/Library\/Caches\u00a0<\/em>directories, and it get deleted when user uninstalls the app from device;<span style=\"font-family: arial, helvetica, sans-serif;\"> Apple accepted such applications in past that store application-specific data, as well as downloadable content in the<strong> \/Document\u00a0<\/strong>directory. Examples are magazine app etc.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><br \/>\nIn iOS 5, the iCloud was introduced; It keeps users&#8217; applications and data synced among different devices. In actual, iCloud sync everything that present in <em>\/Document<\/em> directory for an application. As this data may be large (including downloadable content), Apple has now start rejecting such apps that store their data in the <strong><em>\/Document<\/em><\/strong> directory, saying that as iCloud backups are performed daily over Wi-Fi for each user\u2019s iOS device, it\u2019s 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\u2019s home directory, including its Documents folder, is backed up to iCloud.<\/span><\/p>\n<p>Many developers store all of application&#8217;s data in <strong><em>\/Document<\/em><\/strong> directory. So due to iCloud issue, the option of storing our data at this place has been eliminated.<\/p>\n<p>The alternate was\u00a0<em>\/tmp <\/em>and<em> \/Library\/Caches<\/em>\u00a0directories, as we all knew that they are intact by iCloud and OS; But in iOS 5, there\u2019s an important change with these two directories &#8211;the only two directories that aren\u2019t backed up \u2014 are now\u00a0<em>&#8220;cleaned&#8221;<\/em>\u00a0out\u00a0without any notification or alert to user,\u00a0when 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;<\/p>\n<p><strong>So at this point, all possible places are not reliable to store downloadable data;<\/strong><\/p>\n<ol>\n<li>using\u00a0<em>\/Document<\/em> directory will surly lead our app to rejection.<\/li>\n<li>Cache and\/or tmp directories are afraid of being cleaned out at time if device has low storage space; Worst aspect is user won&#8217;t be notified for both low storage and for cleaning process.<\/li>\n<\/ol>\n<p><strong>Apple suggest two possible solutions for this issue:<\/strong><\/p>\n<ol>\n<li>Mark the files <strong>&#8220;do not backup<\/strong>&#8221; if you dont&#8217; want your file to be backed up by iCloud.<br \/>\n<em><em>Issue: This may be a possible solution but this flag is available from 5.0.1, Not even in 5.0.<\/em><\/em><\/li>\n<li>Your application should store all downloadable data in the 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.<br \/>\n<em>Issue: But even with available, fast, unlimited internet connectivity, randomly deleting an app\u2019s data is still a problem; User may feel annoy by downloading the content time and again.<\/em><\/li>\n<\/ol>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif;\">What I did with my application is<\/span><\/strong><\/p>\n<ul>\n<li>Start storing all downloadable contents in <strong>\/Library\/Cache<\/strong><\/li>\n<li>For existing users, I moved all their contents from <strong>\/Document<\/strong> to<strong> \/Library\/Cache;<\/strong><\/li>\n<li><strong>\/Document<\/strong> directory has now only a database file (which is treated as application specific data) All downloadable contents has moved to <strong>\/Library\/Cache.<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">Here are two links that discuss the whole story in a very nice way:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">First read\u00a0<em><a href=\"http:\/\/www.marco.org\/2011\/10\/13\/ios5-caches-cleaning\" target=\"_blank\" rel=\"noopener\">http:\/\/www.marco.org\/2011\/10\/13\/ios5-caches-cleaning<br \/>\n<\/a><\/em><\/span><span style=\"font-family: arial, helvetica, sans-serif;\">and then\u00a0<\/span><em><a href=\"http:\/\/iphoneincubator.com\/blog\/data-management\/local-file-storage-in-ios-5\" target=\"_blank\" rel=\"noopener\">http:\/\/iphoneincubator.com\/blog\/data-management\/local-file-storage-in-ios-5<\/a><\/em><\/p>\n<p>If anyone has more info on this topic, kindly share;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/s05.flagcounter.com\/count\/AWB\/bg_FFFFFF\/txt_000000\/border_FFFFFF\/columns_8\/maxflags_248\/viewers_0\/labels_1\/pageviews_1\/flags_0\/\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone .. Now a days, we are noticing that many people are getting rejection from AppStore due to storage issue;\u00a0I 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&#8230;<\/p>\n","protected":false},"author":1,"featured_media":5163,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[31,32,150,307,344,529,530,545,547,693,962],"class_list":["post-3162","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios","tag-documents-directory","tag-library-cache-directory-in-ios","tag-apple-guidlines","tag-data-storage","tag-downloadable-contents-in-ios","tag-icloud-and-ios","tag-icloude","tag-ios-data-storage-guidelines","tag-ios5","tag-local-file-storage-in-ios-5","tag-storage-issue-with-ios-5-and-icloud"],"_links":{"self":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/3162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/comments?post=3162"}],"version-history":[{"count":3,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/3162\/revisions"}],"predecessor-version":[{"id":5165,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/3162\/revisions\/5165"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/media\/5163"}],"wp:attachment":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/media?parent=3162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/categories?post=3162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/tags?post=3162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}