Ios application, which is not automatically backed up to iCloud
Original article, reprinted please indicate the source
For ios projects, if you have built-in downloads or programs that dynamically generate files, pay attention to the downloaded or generated files. Do you want to automatically back up the files to iCloud?
If you do not have a proper reason to automatically upload large files, you may not be able to pass the application review and receive a reply similar to this.
We also found that your app does not follow the iOS Data Storage Guidelines, which is required per the App Store Review Guidelines.
For example someone encounters the same problem http://stackoverflow.com/questions/16239147/ios-do-not-back-up-attribute
Apple's setting method: Official Document https://developer.apple.com/Library/ios/qa/qa1719/_index.html
The Code is as follows:
#define DownLoad_Directory "Download_Dir"#pragma mark Download_Dirvoid DeviceClass::initDownloadDir(){ string l_strDocumentDir = cocos2d::CCFileUtils::sharedFileUtils()->getWritablePath(); l_strDocumentDir.append(DownLoad_Directory); NSString* l_strDownloadDir = [NSString stringWithUTF8String:l_strDocumentDir.c_str()]; NSError* l_error; if (![[NSFileManager defaultManager] fileExistsAtPath:l_strDownloadDir]){ [[NSFileManager defaultManager] createDirectoryAtPath:l_strDownloadDir withIntermediateDirectories:NO attributes:nil error:&l_error]; //Create folder // exclude downloads from iCloud backup NSURL *url = [NSURL fileURLWithPath:l_strDownloadDir]; if(strcmp(g_systemVersion.c_str(), "5.1") >=0 ){ if ([url setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&l_error] == NO) { NSLog(@"Error: Unable to exclude l_strDownloadDir from backup: %@", l_error); } } } //this->setDonotBackupInICloud();}Create a new folder in the writable directory to store the downloaded file (if necessary, the automatically generated file will also be placed here), and mark that the directory will not be uploaded to iCloud
Thank you for your reminder.
Test method:
Set-> iCloud-> Manage storage space-> Backup (select a device if multiple devices exist)
If there are many applications, click "show all applications" to check the total capacity of your application and back up the content on iCloud.
When you open and close this interface, you will find that the backup mwjg capacity of your application on iCloud is the same.