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

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

My understanding is the cache directory may be deleted in the event of Low Disc Space not memory. So if someone has their 16gb’s almost full and add some music to their device, then caches may get purged.

See http://iphoneincubator.com/blog/data-management/local-file-storage-in-ios-5

[import]uid: 19626 topic_id: 21511 reply_id: 86328[/import]

Correct. Caches directory never gets backed up.

[import]uid: 19626 topic_id: 21511 reply_id: 86329[/import]

Thanks Rob! [import]uid: 64174 topic_id: 21511 reply_id: 86330[/import]

+1 for do not back up attribute
:slight_smile: [import]uid: 12482 topic_id: 21511 reply_id: 86540[/import]

+1 for the don’t backup attribute!!

Just rejected!

Our client asked for using the bit “do not backup” and we can’t.
Mooved do Cache and we have to start again from zero testing because we developer with 704 and cache is supported on 721.
No documentation at all about cacheDirectory.

This is a really nasty problem. [import]uid: 104317 topic_id: 21511 reply_id: 98929[/import]

FWIW I moved my downloadable stuff to the Caches directory, and the user creatable stuff to documents directory.
Totally not an issue.
If the stuff you download is NOT present in caches, go get it.
But you need to be able to keep going if it is missing.
Essential stuff goes in resources
Temporary / recoverable stuff goes in caches, and it may not be there next time you look/ there may not be space for it.
User content goes in Documents and can get backed up/ may eventually show up in the iCloud.
[import]uid: 108660 topic_id: 21511 reply_id: 99013[/import]

It depends on the amount of data you store in caches and how often it is erased.
If the amount is a couple of undreds of MB of several in-apps, it can be an issue asking the user to get it again.
Moreover the user opens the app and find that the content are not there without a plausible reason as long as you make theme aware that you store data in the cache and sometimes, according to storage, the ios deletes the directory content.

Hope this makes clear the “nasty” definition.

[import]uid: 104317 topic_id: 21511 reply_id: 99024[/import]

Guys,

Just a question:

Where sould I keep some .txt files of my app that are used only to be read by the code and if in the file there is a number 1 it will do something and if not it will do other thing.

So, would I keep this file just into the documents.directory?

Total of 10Kb of .txt files.
PS: I`m not putting it to be checked into the cache directory because the file will be used for the IAP proccess (for the app know if the user bought or not and so do something after reading that .txt files). So if it goes into the cache directory and by some reason be erased…the user would be asked to buy the IAP again, and it is not OK.
Thanks for the advice.

Rodrigo. [import]uid: 89165 topic_id: 21511 reply_id: 99097[/import]

Well if they are read only, why not have them in the resource directory?

As far as IAP goes, you’re supposed to make a call at the beginning of the program to restore previous purchases and this is where you check to see if the customer paid for something. If they delete the app off the device and re-sync it, you’re going to loose any created files, regardless of where you put them, so you have to check with IAP.

[import]uid: 19626 topic_id: 21511 reply_id: 99103[/import]

@Rob, thanks.

You`re right when say about the resources directory (because it would be read file only), yes.

But what about if I code it like: If there is not “file” then create a new one and write something into it. Its only an example but I believe if I want to "write" something (file) then I would not be allowed to use the resources directory, is that right? (principally because am going to code it like this: by the app start it will have already into its sandbox one .txt file, lets say with 0 (zero) written into this file, so when the user start up the app it will read that file and see that it is set to 0 (zero) so it would do nothing and just have a btn where the user click and will be asked to BUY or not the IAP (feature) of the app. IF YES, Ill write/change that file to be written 1 (one) instead zero and so keep it there. When the user starts the app again, the code will check that same file and when it sees that there is a 1 (one) instead the normal ZERO so it would allow the user to not see even more the button to buy the IAP but instead let the user already use the new “screen”(the feature) that will be unlocked due to that “file check” at the app start-up, got it? :\

What am feeling more lost is when you say: “so you have to check with IAP.”

Sorry, but what that means? Doesnt the IAP codo do that "check" already? (as am going to use the IAP code example by **@d3mac123** as can see here: https://developer.anscamobile.com/forum/2011/10/13/app-purchases-help-needed#comment-60894 ) PS: Dont get me wrong please or even my questions not making sense in anyway (as my mind is completely crazy) with this IAP proccess. Arrgh.

Glad to get some light Rob.

Rodrigo. [import]uid: 89165 topic_id: 21511 reply_id: 99108[/import]

No problems Rodrigo.

I’ll try and break this down for you.

It sounds like you want a basic “settings” file, where you are tracking various bits of information about your app.

That kind of file you’re going to create when your app starts up the first time, the file won’t exist, so you will write out the first version of it. Then when you need to update it, you write out your changes.

These kinds of files go into system.DocumentsDirectory. They are critical to the games/apps operation. They cannot be replaced by downloading content from the Internet and its worthy to back them up to iCloud.

When I first read your message above, you said “Read Only”, that means you will never write to it. Read Only files should be in system.ResourcesDirectory. Since they never are written to, they sound like files that should ship with the app, so having them in the app bundle makes sense.
Now lets move on to things purchased by your user. Lets say you write a “1” out to your file showing that the user bought something. What happens when when the user deletes their app and re-installs it? When they delete their apps, it deletes all the files out of the sandbox including the file you saved to system DocumentsDirectory.

Therefore, you cannot depend that when your app starts, you will have a file with a value of 1 in it and you will end up prompting your user to make their purchase again.

To prevent this from happening, if you are using in-app purchases, Apple requires that you make an IAP call to learn what that user has already purchased at the start of your program. It’s called “Restore Purchases”. You can read about it in the IAP API documents.

Hope this helps.
[import]uid: 19626 topic_id: 21511 reply_id: 99118[/import]

@Rob, SURE it helps A LOT!
By the way you understood me very well and I got to understand all you said above as well regarding the “settings file” I want to create.

So by now am on the “half-way”. Because as soon as what you said about the IAP makes complete sense for me as well (concerning checking with the store and not with one “settings file” in the app as it would be “deleted” some wehere) I have no idea right now about what to do regarding this “store call” to “see” if the user has bought or not the IAP and so do the thing acordingly. :\

EDIT: Looking the IAP Docs I understood that as soon as we call the API [lua]store.init(transactionCallback)[/lua] so the AppStore is called and it “will inform” the actual status of the IAP for the user (as purchased, etc). Am I thinking right about that API? :\
Thanks so much for the hand Rob.
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 21511 reply_id: 99145[/import]

+1 for “do not back up” attribute!

Anyone tried this method ?
Download images into Caches Directory, then copy them into Documents Directory later, or when the app is about to suspend [import]uid: 74676 topic_id: 21511 reply_id: 99291[/import]

Is there any chance of the “do not backup” feature being included anytime soon?

Ansca Guys?? Would appreciate some reply, even if in the negative.
[import]uid: 64174 topic_id: 21511 reply_id: 99722[/import]

Created a topic in the Features Request forum, with some source information.

Please, help bump it guys :slight_smile:

http://developer.anscamobile.com/forum/2012/04/13/donotbackup-flag-comply-new-apple-guidelines-downloaded-content-also-allow-folder [import]uid: 10990 topic_id: 21511 reply_id: 100467[/import]