app rejected by apple due to downloading images in documents directory - what to do ?

hi friends we have just submitted one comic book to the appstore which contains 5 books each can be downloaded from our server ( images ) as they are approx 50 - 60 per book so it is necessary to download later but apple has rejected it with following reason

each book can be downloaded with inapp purchase

note :- we are also downloading coordinate file from our server (in json format)

reason is (as per the apple account rejection )

We found that your app does not follow the iOS Data Storage Guidelines, which is not in compliance with the App Store Review Guidelines.

The iOS Data Storage Guidelines specify:

"1. Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the /Documents directory and will be automatically backed up by iCloud.

2. Data that can be downloaded again or regenerated should be stored in the /Library/Caches directory. Examples of files you should put in the Caches directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications.

3. Data that is used only temporarily should be stored in the /tmp directory. Although these files are not backed up to iCloud, remember to delete those files when you are done with them so that they do not continue to consume space on the user’s device.

4. Use the "do not back up" attribute for specifying files that should remain on device, even in low storage situations. Use this attribute with data that can be recreated but needs to persist even in low storage situations for proper functioning of your app or because customers expect it to be available during offline use. This attribute works on marked files regardless of what directory they are in, including the Documents directory. These files will not be purged and will not be included in the user's iCloud or iTunes backup. Because these files do use on-device storage space, your app is responsible for monitoring and purging these files periodically."

For example, only content that the user creates using your app, e.g., documents, new files, edits, etc., may be stored in the /Documents directory - and backed up by iCloud.

Temporary files used by your app should only be stored in the /tmp directory; please remember to delete the files stored in this location when the user exits the app.

Data that can be recreated but must persist for proper functioning of your app - or because customers expect it to be available for offline use - should be marked with the "do not back up" attribute. For more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?.

It would be appropriate to revise your app to meet the requirements of the iOS Data Storage Guidelines.

For discrete code-level questions, you may wish to consult with Apple Developer Technical Support. Please be sure to prepare any symbolicated crash logs, screenshots, or steps to reproduce the issues for when the DTS engineer follows up. For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.

I am not sure Corona lets you read/write from /Library/Caches

If that's the case, the only thing I can think of doing would be to place the images in the tmp directory and delete them when the user exits the app. Then redownload them each time. And yes, I think that solution sucks as much as you do. So I hope someone else can give a better answer. I'm assuming you've chosen this model because you'd like your app to act as a "comic book store" and want to remain under the 20mb limit :P

yeah i had choose this model to make it like comic book store and yes you are right cant put that in temp directory as each book is approx 50-60 mb :(

thnx for reply

Apple seems to be getting pretty picky on using the Documents Directory, I guess because it eats up iCloud space. Our apps may be iCloud and we not even know it :-)

Just download them to system.CachesDirectory instead.

just wondering not heard about caches directory was the data will lost on app exit or on any other way?

When we talk about caching with websites the idea is to download once and reuse many times until its been updated in which case the new file replaces the old. Caches can be cleared by automatic processes and downloaded again when needed.

So yes the caches folder is not permenant but it's not like the temporary folder that is purged all the time.

The real answer is implement the no-backup flag which I don't think we can and beg apple to let you use documents since its more permenant additions

I know apple is wanting anything "episode" like to go to the caches folder

Uh thats bad news! We have just submitted an app which does the same! :(

Guess I'll have to wait for Apple to reject it.

BTW I Just noticed that cachesDirectory had been added to iOS. Its high time Ansca kept their docs updated.

@hgyvas123, @Satheesh - Any NEWS about this guys?

Aren`t we alowed to use the DocumentsDirectory?

Thanks,
Rodrigo.

for this type of case we are not allowed for the stuff like db or storage we can use [i think so :D]

we are thinking to use caches directory instead or break the book to individual not decided yet

:)

@hgyvas123 - Thanks for the reply! :)

Cheers,
Rodrigo.

welcome dude

:)

The way I understand what Apple wants is that permanent content like your saved game settings or the database that drives your app and things that need backed up to iCloud go into system.DocumentsDirectory.

Things you download from the internet that can be recreated if necessary are to be cached. Meaning that your app should use the downloaded file unless either a) a newer version is available or b) the cached file had to be removed because of a low disc space issue. These types of files should go to system.CachesDirectory.

Things that you don't care about the life span and are okay to be trashed when your app exits are temporary files and need to go to system.TemporaryDirectory.

@hgvyas123 creates an interesting quandry. The content should be permanent. The app owner chose to purchase an extension to the app. But its probably a lot of data and would probably quickly blow out the app owner's free iCloud space (since we cannot currently mark files as "no backup". The app owner should not be forced into downloading it again because it was removed from cache since this isn't really re-creatable, updating Internet data. But on the other hand it is. Since it's not an app, any updated would have to come from downloading it from the net. Assuming there isn't a low disc space issue to cause the cache to be emptied, it should be able to stay for a good long time.

I see both sides of this.

Yup! rejected by apple. same reasons.
uploading a new version which uses Caches Directory!

"Use the "do not back up" attribute for specifying files that should remain on device, even in low storage situations. Use this attribute with data that can be recreated but needs to persist even in low storage situations for proper functioning of your app or because customers expect it to be available during offline use"

Is that possible with Corona?

So like downloadable levels (read: JPGs for maps, kinda big maybe 200-600kb, new spritesheets, etc.) would be kosher to put in the system.CachesDirectory then? Is that what I'm taking away from this? I hope so. :)

ya exactly!
But for the downloaded content never to be deleted from the Caches Directory, seems we need to set the "do not back up" attribute.

+1 for the don't backup attribute.

+1 for the don't backup attribute!!

w00t!

yeah! +1 for "do not back up" attribute!

@robMiracle

Items from cache Directory are deleted ONLY in the event of low memory space, is that right?

views:2681 update:2012/2/12 11:34:30
corona forums © 2003-2011