Documents to store file rejected solution (file Storage Policy response)

Source: Internet
Author: User

Apple has put new demands on the app's file storage when it comes to the iOS 5 system. From its guildline, it is recommended that developers try to put the app-generated files in the caches directory. The original text reads as follows:

Only user-generated data or cannot otherwise is recreated by your application, should is stored in the/documents dir Ectory and rest should be stored to/library/caches directory.

What happens when you do it?

If you do, there are two things.

    1. If you ignore this, continue to put the app generated files in the documents directory, then these files will be backed up to itunes or icloud. If these files are large, then the user may need to consume a lot of traffic in order to sync, and then Apple might reject your app shelves, which is a tragedy.
    2. If the developer does what Apple says and puts the app-generated files in the caches directory, Apple won't reject your app, and it's happy. But iOS 5 will remove files from the caches directory when disk space is tight, which could be a bigger tragedy for users.
How do I respond to a new file storage policy?

Developers are stuck in a dilemma, but when it comes to iOS 5.0.1, developers have a third choice:

    • Continue to store files in the documents directory, but mark these files as no backup required. For more information, please refer to Technote (QA1719)

The original text reads as follows:

The Q:my app has a number of files, need to being stored on the device permanently for My apps to function properly offline. However, those files do not contain the user data and don\ ' t need to is backed up. How should I store those files in IOS 5?

A:starting in IOS 5.0.1 a new \ "does not back up\" file attribute have been introduced allowing developers to clearly SPECIF Y which files should is backed up, which files is local caches only and subject to purge, and which files should not being B Acked up but should also isn't be purged. In addition, setting this attribute on a folder would prevent the folder and all of its contents from being backed up.

code example

The code for the file plus \ "Do not go back Up\" property is as follows, and it is important to note that this is an iOS 5.0.1, which is less laborious than this version.

#include <sys/xattr.h>- (BOOL)Addskipbackupattributetoitematurl:(Nsurl*)Url{ Const Char*FilePath= [[URL Path]Filesystemrepresentation]; Const Char*Attrname=\ "com.Apple.Mobilebackup\"; u_int8_tAttrValue= 1 int result = setxattr< Span class= "pun" > (filepath, Attrname,< Span class= "PLN" > &attrvalue, sizeofattrvalue0, 0); return result == 0}             /span>                

Documents to store file rejected solution (file Storage Policy response)

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.