How to delete automatic data backup from iCloud in ios app

My application is being rejected from the app store due to iCloud backup until I save data to iCloud. Please help me.

+4
source share
4 answers

But suppose you save some data in a document directory. Apple states that you must flag this data that iCloud is not backed up. This can help. (But it should also be in the answer received from Apple.

+1
source

By default, any data stored in the applicationโ€™s document directory is backed up to iCloud. Apple iOS Storage Guides (found here ) indicate that any data that can be recreated by the user should NOT be copied to iCloud.

You have a couple of options here.

  • Save the data in <Application_Home>/Library/Caches or <Application_Home>/tmp depending on your use

  • Mark the files that you save in the Documents directory with the โ€œdo not back upโ€ flag (as described here )

+1
source

Use attributes for all files :)) (of course, you can eliminate the need)

IN

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

Add this.

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; [self applyAttributes:documentsDirectory]; paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); documentsDirectory = [paths objectAtIndex:0]; [self applyAttributes:documentsDirectory]; paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); documentsDirectory = [paths objectAtIndex:0]; [self applyAttributes:documentsDirectory]; -(void)applyAttributes:(NSString *)folderPath { NSArray *filesArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:folderPath error:nil]; NSEnumerator *filesEnumerator = [filesArray objectEnumerator]; NSString *fileName; while (fileName = [filesEnumerator nextObject]) { if([self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:[folderPath stringByAppendingPathComponent:fileName]]]) { //NSLog(@"success applying"); } } } - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL { if([[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; } return NO; } 
+1
source

Just modify the Cordova.plist file. Cloud backup = no changes. Accept help from the link in the cord structure. This will not work for native applications. For a native application, the developer notifies or authenticates the user that the application will create storage in iCloud.

+1
source

Source: https://habr.com/ru/post/1480459/


All Articles