Search code examples
iosicloud

Mark as "Do Not Back up"


I have a somewhat large database shipping with my application that is ONLY readable (the user writes nothing to this database). I'm looking for a very simple way to make sure that this database is not backed up. Is there an easy way to mark the database file as "do not back this up"?


Solution

  • Create an NSURL instance with your file, and then set the NSURLIsExcludedFromBackupKey resource value:

    [url setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:NULL]; // Can use an NSError for error reporting of course
    

    From QA 1719