iOS apps, set up to not proactively back up to icloud

Source: Internet
Author: User

Original articles, reproduced please indicate the source

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

Assuming you don't have the right reasons to upload large files yourself, you might not be able to pass an app 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

Applied to the project, detailed code such as the following

#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 under the Writable folder, store the download file (if necessary, your own active files are also placed here), and mark the folder will not be uploaded to icloud

Thank Mei Jun colleagues for their reminders


Test method:

Set up->icloud-> management storage (if you have multiple devices, select devices)

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.

iOS apps, set up to not proactively back up to icloud

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.