Don't back up iOS is being detained

Source: Internet
Author: User

See hair application was rejected, or very depressed, for the card:


Some iOS projects have been sent, but no items have been sent that require a large number of files to be downloaded from the server. iOS authenticator thinks my app stores nearly 20M in icloud, wasting user space,

I am deeply sorry about that.


Looking at the data and finding out that you really don't understand the storage rules for iOS, http://www.cocoachina.com/bbs/simple/?t86244.html this blog post (canonical translation) is very detailed,


Key Data
These are user-created data, or other data that cannot be regenerated. Should be stored in the <application_home>/documents directory and should not be marked as a "do not backup" property. Critical data is retained in low storage space and is backed up by icloud or itunes.

Cache Data
data that can be re-downloaded or generated without this data will not prevent users from using the app's functionality offline. The cached data should be stored in the <application_home>/library/caches directory. Cached data may be deleted when the device is low on storage, and itunes or icloud will not back it up.

Temporary Data
applications need to write to local storage, using temporary data internally, but do not need to be retained for long-term use. Temporary data should be saved in the <application_home>/tmp directory. The system may empty the data in that directory, nor will itunes or icloud back it up. Applications that do not need to use this data should delete temporary data as soon as possible to avoid wasting the user's storage space.

Offline Data
can be downloaded or recreated, but users want to be able to access the data when they are offline. Offline data should be stored in the <application_home>/documents directory or the <application_home>/library/private documents directory and marked as "Do not Backup property. The data in both locations is preserved when the storage space is low, and the Do not backup property blocks itunes or icloud backups. When an app no longer needs an offline data file, it should be deleted as soon as possible to avoid wasting the user's storage space


and the files I downloaded have key data, and there are no tagged attributes, so icloud will back up all <application_home>/documents if you turn on backup . Of course if it is IOS5.0.1, even if you mark it, it will be automatically backed up.

So if your application is going to fit into 5.0 or even 4.3, you need to do a good job of adapting it.


My handling is:

1.5.0.1 or more are stored in the <application_home>/documents, and marked as do no back up, 5.0.1 are saved to the <application_home>/ Library/caches Directory

2. For important documents, and smaller, can be stored in <application_home>/documents.


Part of the code:

if (function->isiosfiveup()) {

Cclog (" platform greater than 5.0");

Platformsavepath =ccfileutils::sharedfileutils() Getwritablepath();

}Else{

Cclog (" platform is less than or equal to 5.0");

Platformsavepath = function->getplatformsavepath();

}

To add a do not to back up label:

Const char* attrname = "Com.apple.MobileBackup"; u_int8_t attrValue = 1;setxattr (Path.c_str (), Attrname, &attrvalue, sizeof (AttrValue), 0, 0);   This method   #include <sys/xattr.h>   does not have to call other

Add a label to remember that the file was just created successfully and is in a closed state, otherwise the token fails.





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.