Search code examples
iphoneobjective-citunes

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?


Solution

  • 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];