Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude files from application backup

Is there a way to exclude some of the files in your application bundle from being backed up to the user's computer? I have a photo browsing application that allows you to store photos/videos locally, when a user goes sync their device and the application is backed up its taking a really long time since its backing up all the locally stored photos/videos as well. Is there perhaps a directory (/tmp/?) that won't be backed up?

like image 649
Shizam Avatar asked Dec 16 '22 23:12

Shizam


2 Answers

Yes you must put files that you don't want to backup to Caches directory. Path can be obtained:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); 
NSString *cachesPath = [paths objectAtIndex:0]; 
like image 81
Vladimir Avatar answered Dec 19 '22 12:12

Vladimir


iOS Applocation Programming Guide: A Few Important Application Directories talks about which folders are backed up and which aren't. You should use <Application_Home>/Library/Caches to store persistent data that does not need to be backed up.

iPhone Application Programming Guide: Getting Paths to Application Directories shows how to get the path to that folder by using NSSearchPathForDirectoriesInDomains with NSCachesDirectory parameter.

like image 29
Franci Penov Avatar answered Dec 19 '22 12:12

Franci Penov