Applications must follow iOS storage guidelines or they will be rejected

I have developed an application that can download mp3 files (from 6 to 8 mb in size) from online and stored in NSDocumentDirectory. my application is rejected today and says that

"Apps must follow the iOS Data Storage Guidelines or they will be rejected" We found that your app does not follow the iOS Data Storage Guidelines, which is required per the App Store Review Guidelines. The iOS Data Storage Guidelines indicate that only content that the user creates using your app, eg, 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. " 

I used to store music files in NSDocumentDirectory. so this is the first time I do this, I canโ€™t understand what the problem is. what should I do to resubmit my application for adoption.

here is my code

  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [[paths objectAtIndex:0]stringByAppendingPathComponent:[NSString stringWithFormat:@"psalmsMusic%d.mp3",i]]; NSLog(@"ddddddd psalmsMusic%d.mp3",i); i++; NSLog(@"path %@",documentsDirectoryPath); [receivedData writeToFile:documentsDirectoryPath atomically:YES]; 

really need help.

+4
source share
7 answers

I rejected the application for the same reason, the solution is really simple, and not save the downloaded files to the document directory, which you must save in the Cache directory, which is a temporary directory that is not supported by iCloud and may be accidentally deleted by the OS in certain cases .. . so you save the file in the cache directory

 NSString *filePath = [[self applicationCachesDirectory] stringByAppendingPathComponent:fileName]; BOOL flag = [[NSFileManager defaultManager] createFileAtPath:filePath contents: receivedData attributes:nil]; 

EDIT

 NSString *filePath = [[self applicationCachesDirectory] stringByAppendingPathComponent:[NSString stringWithFormat:@"psalmsMusic%d.mp3",i]]; NSLog(@"ddddddd psalmsMusic%d.mp3",i); i++; BOOL flag = [[NSFileManager defaultManager] createFileAtPath:filePath contents: receivedData attributes:nil]; if ( flag ) NSLog("success"); 
+7
source

Once iCloud is implemented at Apple, the Document catalog data is somehow related to iCloud Storage. Consequently, Apple now rejects applications that use heavy data storage in the document directory.

You need to save the data in another place. Store MP3 files elsewhere.

This link can help you.

http://www.techotopia.com/index.php/Working_with_Directories_on_iOS_4_%28iPhone%29

Hope this solves your problem.

Then follow ..........

IOS storage guides indicate that only content created by the user using your application, such as documents, new files, changes, etc., can be stored in the / Documents directory and supported by iCloud.

Temporary files used by your application should only be stored in the / tmp directory; do not forget to delete files stored in this place when the user exits the application. Data that can be recreated, but must be saved for your application to work properly, or because customers expect it to be available for offline use, should be marked with the โ€œdo not back upโ€ attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent backing up the corresponding file. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute.

See http://developer.appcelerator.com/question/134926/ipad-app-rejected-ios-data-storage-guidelines for more details.

+3
source

Apple wants to reduce the size of your backup.

First, stop using documents. This does not fit.

If you can download the files again easily enough, you should store them in a place where they will not be copied. I suggest cache. If they are cleaned, you should simply load them again.

If downloading them again is difficult, they should be stored in a different location in the Library folder.

You can find the Caches directory using:

 NSArray *paths = NSSearchPathForDirectoriesInDomains( NSCachesDirectory, NSUserDomainMask, YES); 

Basically, this is what you have now, but instead of NSDocumentDirectory you use NSCachesDirectory .

If you manage the file names, this is normal as it is. If you do not, you should probably create a subdirectory and work from there so as not to run into anything.

+3
source

You cannot save to NSDocumentDirectory because this directory is now synchronized with iCloud. But you can use NSCachesDirectory or use a temporary directory as Apple comment states for the storeโ€™s music file.

+1
source

the guidelines say that only important files that cannot be recreated (downloaded) from the Internet should go to the document directory, because this t

+1
source

According to the iOS Storage Guide (which can be found at http://developer.apple.com/icloud/documentation/data-storage/ ), you must place all user-created files in the Documents directory and all re-loaded content in the Caches directory . So you should put the sqlite database there.

The background to this is that starting with iOS 5, the document catalog is an iCloud backup. Since many applications tend to store their full data, iCloud backups take on a rather large size that uses free space and creates network traffic, both of which in turn annoy the user because he / she wonders why. To mitigate this, Apple now seems to take a closer look at what is stored in the Documents directory, and if it is possible to regenerate content (for example, downloadable files).

Beware that the Caches directory can and will be cleaned up on iOS 5 by the operating system when free space on the device becomes low. Thus, your application can no longer assume that everything is as it was before, but you need to reinstall it every time you access something from your cache.

Hope this helps ...!

+1
source

my application was also rejected for the same reason - (2.3)

try it -

NSString * paths = NSSearchPathForDirectoriesInDomains (NSCachesDirectory, NSUserDomainMask, YES);

The advantage of this is that when your device is synchronized with the cloud, while the application data will not be synchronized, because it is in NSCachesDirectory instead of NSDocumentDirectory.

And the disadvantage is that whenever you use your device, and if your device has less memory. then to get free space the processor will have a clear cache. therefore, if you have data for offline use, you may lose.

2) If you cannot use NSCachesDirectory (perhaps because your data is too important), you can go this way -

use this method and specify the database path - 'addskipbackupattributetoitematurl'

follow this link - How to use addSkipBackupAttributeToItemAtURL API?

0
source

All Articles