Baker app rejected for violation of data storage guidelines
Just had my first Baker app rejected for violation of the data storage guidelines. I was using Baker 3.02.
Is this something to do with the iOS 5.01 update, and how local files are stored on iCloud? I haven't done any fancy html5 local caching or local storage of any sort.
Here is the full note from the App Store review team:
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.
- 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.
- 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.
- 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."
Is this just a simple setting I've overlooked? I don't see anything in a search of the latest issues or wiki.
Put book to cache directory
// ****** BOOK DIRECTORIES
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)
objectAtIndex:0];
Ok, that's new. :|
@psmedia Just a question: in your app were you downloading a book? Or it was just a single issue? I'm asking this just to narrow down the problem.
@zenz I don't think it's so easy. We had to relocate it already a couple of times, plus, the book is inside the app, not in any other folder. There are however a few things that might have triggered that issue: downloaded book and screenshots, for example.
We'll look into it asap. :)
Hi! Folletto,
As I tested. change it like what I do, every things including screenshots will be placed in the Cache folder, because the documentsPath is the base of other relative path.
As I remembered, the Apple official suggestion is to store those things which re-downloadable to Application's Library/Caches folder(like books mags). That's the reason I put them there.
There's also another solution, mark the book folder in documents to be "do not back up". I didn't try it yet.
#include <sys/xattr.h>
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}
using this solution, you must write this attribute to the book's path after extracting the book
I think psmedia got this warning because his app download books to the documents folder(and it's too big maybe).
Single issue app only.
@psmedia thanks. So it's probably an issue with the screenshot mode. :)
@zenz Yes. It's probably due to the change in iOS 5.0.1. One of the problem we found in 5.0 was that our data shouldn't expire and shouldn't be either backed up, that's why we had that problem.
Thanks for the source! If you have time for testing, why don't you make the patch and push it to Baker's repo? :)
Yes, perhaps screenshots are too much in psmedia's app.
I also use screenshot mode in previous version of my app. but it pass the exam.
we have the same problem, and change it, it´s for iCloud,
we change in RootViewController.m
// ****** BOOK DIRECTORIES // ******* MUTADOR CODE para cambio del directorio a Cache NSCachesDirectory //NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
App has 26 screens and is in screenshot mode.
OK, I've updated the RootViewController.m as per @mutador and @zenz. I'll let you know results as soon as I hear back from Apple. Thanks very much for the swift feedback!
NB: I notice I also get a warning re the previous line
NSArray *documentsPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
telling me that documentsPath is an unused variable. I guess it's getting used in the next line?
Ok, I have updated the code to conform to Apple Data Storage Policy with commit 1c5f82195d.
- Screenshots of the bundled book taken by Baker are saved in <Application_Home>/Library/Caches since they can be regenerated by the application at any time.
- Downloaded books and their screenshots are saved in <Application_Home>/Library/Private Documents since books have to be available permanently until discarted even in offline mode
Both screenshots and books directories have the skip backup attribute set on at creation.
For details about Apple Policy see Apple Technical Q&A QA1719
Now this should keep Apple happy and Baker apps safe :) As always any test or feedback (expecially the ones from Apple itself) is kindly appreciated.
Awesome! :D
my feedback is newstand, jajajajajaja ...yes i know....best regards @Xm4s.
Thanks all, sorry not to reply earlier, but app was approved with @zenz's code and is now available on appstore via www.psmedia.com.sg/vote2011.html. Only $1.99, all proceeds to support photojournalist students in Singapore.
App is based on wonderful photojournalism of a group of young Singaporean photojournalists, but also includes:
- vertical page navigation adapting @ffranke's Laker's slideshow for fullpage vertical "slides" or pages
- Laker's flipcards
- "create your own collage" using touch-punch for jquery conversion of draggable to touch
Thanks to this terrific community for all your help!