File classification, storage path, and file attributes for iOS

Source: Internet
Author: User

Key data

Content: User-created data files that cannot be recreated automatically after deletion and

Path: Home directory/documents

Properties: Do not set "do not back up"

Management: iOS systems are not purged when they are running out of storage space and are backed up to itunes or icloud

Cache data

Content: can be used for offline environment, can be repeated download duplicate generation, immediately when offline, the application itself can function

Path: Home directory/library/caches

Properties: Default

Management: Empty in case of insufficient storage space, and will not be automatically backed up to itunes and icloud

Temporary data

Content: Files that are temporarily generated for an internal operation when the app is run

Path: Home Directory/tmp

Properties: Default

Management: May be purged by iOS system at any time, and will not be automatically backed up to itunes and icloud, try to apply your own situation when the files are no longer in use, and avoid wasting on user device space.

Offline data

Content: Similar to cached data, it can be re-downloaded and rebuilt, but users tend to expect data to remain in place while offline

Directory: Home directory/documents or home directory/library/custom Folder

Properties: Do not need to set in documents, put in the custom folder should be set "do not Backup"

Management: Similar to critical data, it will not be clear when there is not enough storage space, the application should clean up files that are no longer used, so as not to waste user device space

Settings introduced from iOS5.0.1 do not back up files (folders also apply) Extended properties

1 #include <sys/xattr.h>
2-(BOOL) Addskipbackupattributetoitematurl: (Nsurl *) URL
3 {
4 const char* FilePath = [[URL path] filesystemrepresentation];
5
6 const char* Attrname = "Com.apple.MobileBackup";
7 u_int8_t attrValue = 1;
8
9 int result = Setxattr (FilePath, Attrname, &attrvalue, sizeof (AttrValue), 0, 0);
Ten return result = = 0;

11}

1. List extended properties for the corresponding path

ssize_t listxattr (const char *path,//path

Char *list,//is an extended attribute name, is an array, each extended property is terminated with a. Example: user.name1\0system.name1\0user.name2\0

size_t size);//allocation of cache sizes

The size of the extended attribute is returned, including/0;

2. List values for extended properties

ssize_t getxattr (const char *path,//Path

Const char * name ,//Extended attribute name

void * value ,//the value corresponding to the extended property

size_t size                    ); Length of Extended property

3. Set extended Properties

Setxattr (path,//Paths

Key,//The name of the extended property

value,//values of extended properties

Size,//length of extended property

flags);//Logo

File classification, storage path, and file attributes for iOS

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.