ios - Preventing files inside a folder to be backed up icloud -


Thanks in advance for help I have excluded a folder from backing up via iCloud, but still it will backup the files And when i visited iCould it is backed up. I use the following code to exclude the directory from backing up

  - (BOOL) addSkipBackupAttributeToItemAtURL: (ns URL *) URL {// emphasis ([[NSFileManager default manager] filexestappath : [URL Path]]); NSError * Error = Zero; BOOL success = [URL setrSourceValuue: [NSNumber NumberVithibles: Yes] For: NSROMLXMedged Backup Error: & amp; Error]; If (! Success) {NSLog (@ "error except% @ from backup% @", [url's final footprint], error); } The success of the return; }   

And I call the above method as Behole NSArray * path = NSSearchPathForDirectoriesInDomains (NSLibraryDirectory, NSUserDomainMask, YES); NSString * libraryDir = [Path object imported index: 0]; NSString * downloadFolder = [Library stringbapping padcampaint: @ "downloads"]; NSError * error; If (! [NSFileManager defaultManager] fileExistsAtPath: downloadFolder]) [[NSFileManager defaultManager] createDirectoryAtPath: Intermediate Directories with DownloadFolder: No Properties: Zero Error: & amp; Error]; // Create folder NSURL * documentURL = [NSURL URLWithString: downloadFolder]; [Self add skypeback attitivity ooThumarthal: documentURL];

import this sys / xattr.h

  - (BOOL) addSkipBackupAttributeToItemAtPath: (NSString *) path {BOOL success = no; Const char * filePath = [Path File System Reputation]; Const char * attrName = "com.apple.MobileBackup"; Zero * Check = (Zero *) and Unsubscribe with NSUILX; If (check! = NULL) {// First try and delete the extended attribute, if this is the current int result = getxattr (filePath, attrName, NULL, sizeof (u_int8_t), 0, 0); If (result! = -1) {// attribute exists, we need to remove it int removeResult = removexattr (filePath, attrName, 0); If (removeResult == 0) {NSLog (@ "Extended feature removed on the path% @ @", path); }} NSURL * url = [NSUr file URL path: path]; Success = [url setrrsource value: [nsnumber number whitabulls: yes] k: nsurilcledform backback error: zero]; } Else {// IOS 5.0.1 and less u_int8_t attrValue = 1; Int result = set extractor (filtrate, etrnem, and ativalue, psychofuel, 0, 0); Success = (results == 0); } NSLog (@ "Leave the backup attribute for items on the path:% @, results:% d", path, success); The success of the return; }   

I hope this will work ...

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -