Skip to main content

New file attribute for non-purgeable, non-backed up file

To set the "do not back up" attribute, add the following method to a class in your application. Whenever you create a file that should not be backed up to iCloud, write the data to the file and then call this method, passing in a URL that points to the file.


#include
- (void) AddSkipBackupAttributeToFile: (NSURL*) url
{
  u_int8_t b = 1;
  setxattr([[url path] fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
}


Apple Developer - iOS 5.0.1
See iCloud Data Storage Guidelines
See Apple Developer Library: How do I prevent files from being backed up to iCloud and iTunes?

Comments