my application rejected due to this issue :
https://i.stack.imgur.com/EwGTF.png
My application is a dictionary which uses SQL DBs , with bookmarking and etc ...
so I copied this code from Apple docs in appDelegate.m :
- (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;
}
but used like this :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self addSkipBackupAttributeToItemAtURL:[NSURL URLWithString:@"<myApplication>/Library/Caches"]];
}
but crashes with this reason :
Assertion failed: ([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]), function -[AppDelegate addSkipBackupAttributeToItemAtURL:], file /iData/Development 2011/My iPhone Project/APPNAME/APPNAME/AppDelegate.m, line 27.
According to that picture is this my only problem for rejection ? because this is my first time I work with data base .
Thanks . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EDITED :
- (NSString *) getDBPath
{
NSInteger kValue = [[[NSUserDefaults standardUserDefaults] stringForKey:@"Bv"] intValue];
NSString *documentsDir = [[NSString alloc] init];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
documentsDir = [paths objectAtIndex:0];
switch (kValue) {
case 0:
documentsDir = [NSString stringWithFormat:@"%@/eng-per.sqlite", documentsDir];
break;
case 1:
documentsDir = [NSString stringWithFormat:@"%@/eng-per.sqlite", documentsDir];
break;
case 2:
documentsDir = [NSString stringWithFormat:@"%@/per-eng.sqlite", documentsDir];
break;
}
return documentsDir
}
and then changed to this in app delegate.m :
[self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:dbClass.getDBPath]];
now app lunches fine without crash