I have created an ebook and ePaper app and my app contains a lot of images and pdf files and I was putting the downloaded images , pdf files Documents directory
Image directory:
NSString *strPageURL = [dictPage valueForKey:@"imagelink"];
strPageURL = [strPageURL stringByReplacingOccurrencesOfString:@"\n" withString:@""];
strPageURL = [strPageURL stringByReplacingOccurrencesOfString:@"\t" withString:@""];
strPageURL = [strPageURL stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString* strFileName = [strPageURL lastPathComponent];
NSString *strDestFile = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/%@",strFileName]];
Pdf Directory
NSString *strThumbURL = [dictPage valueForKey:@"thumbimage"];
// NSLog(@"%@",strThumbURL);
NSString* strThumbName = [strThumbURL lastPathComponent];
NSString *strThumbPath = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/%@",strThumbName]];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:strThumbPath];
How do I prevent files from being backed up to iCloud and iTunes?
--------------------------how to implement this method in my code-----------------------------------
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
NSError *error = nil;
BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
forKey: NSURLIsExcludedFromBackupKey error: &error];
if(!success){
NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
}
return success;
}