Apple docs offer this in iOS 5.1 and later:
NSURL *storeUrl = [NSURL fileURLWithPath:[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"your_file"]]; NSError *error; [storeUrl setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error]; if (error) { NSLog(@"couldn't exclude database from backups: %@", [error localizedDescription]); }
source share