0

I am new in iOS development. My app was rejected because it must follow the iOS Data Storage Guidelines. I have already read some answer here on Stack Overflow, and I have already read some blogs.

I am using this following method in my appdelegate.m for stop icloud back up. My database size is 79mb.

- (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *)path {
    NSURL *url = [NSURL fileURLWithPath: path];
    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;
}

I have also used this code:

 NSArray *pathsa = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
    NSString *basePath = ([pathsa count] > 0) ? [pathsa objectAtIndex:0] : nil;
    NSArray *documents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:basePath error:nil];
    NSURL *URL;
    NSString *completeFilePath;
    for (NSString *file in documents) {
        completeFilePath = [NSString stringWithFormat:@"%@/%@", basePath, file];
        URL = [NSURL fileURLWithPath:completeFilePath];
        NSLog(@"File %@  is excluded from backup %@", file, [URL resourceValuesForKeys:[NSArray arrayWithObject:NSURLIsExcludedFromBackupKey] error:nil]);
    }

But still its showing 109 MB in iCloud Storage.

halfer
  • 19,824
  • 17
  • 99
  • 186
sambit
  • 41
  • 5
  • How do you open your Sqlite database if you don't know the path to the file? – Thilo May 13 '16 at 07:04
  • i am using following code for open database. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:ddb]; – sambit May 13 '16 at 07:14
  • Could that last `*path` be your database path then? – Thilo May 13 '16 at 07:21
  • I am using Dbmanager class for create databse.i want call my database path in appdelegate class. – sambit May 13 '16 at 07:26

0 Answers0