iOS apps, set up not automatically backed up to icloud

Source: Internet
Author: User

Original articles, reproduced please indicate the source

iOS project, if you have a built-in download or a program dynamically generated files, you should pay attention to the downloaded or generated files, do not automatically back up to icloud

If you do not have the right reason to upload large files automatically, you may not be able to pass the application audit. Received a reply like this

We also found that your app does not follow the IOS Data Storage guidelines, which is required per the app Store Review Gu Idelines.

For example, someone encounters the same problem Http://stackoverflow.com/questions/16239147/ios-do-not-back-up-attribute

Apple gives the Setup method: Official Document Https://developer.apple.com/Library/ios/qa/qa1719/_index.html

Apply to the project, 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] CreateDirectory Atpath:l_strdownloaddir Withintermediatedirectories:no Attributes:nil error:&l_error]; Create folder//exclude downloads from ICloud backup nsurl *url = [Nsurl Fileurlwithpath:l_strdow        Nloaddir]; if (strcmp (G_systemversion.c_str (), "5.1") >=0) {if ([url setresourcevalue:[nsnumber numberwithbool:yes] for Key:nsurlisexcludedfrombackupkey Error:&l_error] = = NO) {NSLog (@ "error:unable to exclude L_strdownloa    Ddir from backup:%@ ", l_error);        }}}//this->setdonotbackupinicloud ();} 
is to create a new folder in the writable directory, to store the download file (if necessary, automatically generated files are also placed here), and mark this directory will not be uploaded to icloud

Thank Mei Jun colleagues for their reminders


Test method:

Set up->icloud-> management storage (select Device if multiple devices are available)

For more apps, click "Show All Apps" to find your app and back up the total capacity of your content on icloud.

By opening and closing this interface, you will find that your app's backup MWJG capacity on icloud is not the same.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.