-1

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;
}
Ravindhiran
  • 5,304
  • 9
  • 50
  • 82

1 Answers1

1

Yes your app may get rejected if you download large data and store it in Documents directory. I have faced this problem.

read more here iOS 5 does not allow to store downloaded data in Documents directory?

Adding the "Do Not Backup" attribute to a folder hierarchy in iOS 5.0.1

Community
  • 1
  • 1
Surender Rathore
  • 845
  • 8
  • 18