Basic flag "do not reserve"

My application has a basic data db that populates the first time it is launched for offline use. This db is then synchronized in every run with online db. Only the first run contains a significant amount of data. The application also extracts some images from the Internet, which are then converted to binary data and stored in the main data for offline use. This happens only when the user goes to the section containing some images and only those images are extracted (the application does not extract all the images at the same time, only as needed).

I use magic notation.

I do not save any data to a file at runtime. However, my application was rejected with this message:

We found that your application does not comply with the iOS Storage Guides required by the Store App Review Guide.

He advises me to check "Settings> iCloud> Storage and backup> Storage management", but my application doesn’t even show it.

I understand that I should mark the main data, not bakcup for iCloud, but I do not understand how to do it. Presumably, I should implement something similar, but I don’t know how to apply it to my main data files.

- (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; }
+5
source share
2 answers

Below may be better than modifying the MacigalRecord source files. In fast

MagicalRecord.setupCoreDataStackWithAutoMigratingSqliteStoreNamed("somedb.sqlite")
let dbPath = NSPersistentStore.MR_urlForStoreName("somedb.sqlite")
do {
  try dbPath.setResourceValue(NSNumber(bool: true), forKey: NSURLIsExcludedFromBackupKey)
} catch let error {
    print(error)
}
+2

: NSPersistentStoreCoordinator+MagicalRecord.m

:

- (NSPersistentStore *)MR_addSqliteStoreNamed:(id)storeFileName withOptions:(__autoreleasing NSDictionary *)options

:

if (!store) 
{
    [MagicalRecord handleErrors:error];
}

:

if (!store) 
{
    [MagicalRecord handleErrors:error];
}
else
{
    [self addSkipBackupAttributeToItemAtURL:url];
}

, - , , . , , .

+1

All Articles