Reputation: 1981
My app has downloadable content which I am keeping in Documents Directory. Which gets backed up on iCloud. So instead of setting "Do not backup" of all individual files can I put them under one directory in side Documents and set the "Do not backup" on that directory will that work? or do I have to set the flag on all individual files.
Upvotes: 0
Views: 430
Reputation: 4296
This happened to me too. Read this apple storage guideline
In a nutshell for your app you want to follow guideline #2
Data that can be downloaded again or regenerated should be stored in the /Library/Caches directory. Examples of files you should put in the Caches directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications.
Upvotes: 0
Reputation: 955
You can store all temporary files or any other data which your program can genrate without help of users-(which is not user created data) at Library/tmp folder - Library/tmp folder is not insider document folder, Its folder at the same level of Document directory.
You will not need to add donotbackup attribute to all files then.
Thanks!
Upvotes: 0
Reputation: 2132
Use below code in your application before saving database to your document directory..
-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
// NSLog(@"Attributs : %d and Path : %@",result,URL);
if (result != 0) {
NSLog(@"File Backup Attribute setting error");
}
return result == 0;
}
Upvotes: 1