Avoid backup of Cookies.binarycookies file

Hello to everyone,

my iOS banking app has a WKWebView that shows a webpage from an external supplier. For security reasons the file Cookies.binarycookies generated by this webpage should not be present in the backup of the app. I've implemented this code but it doesn't work

 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
    BOOL result = NO;
    NSURL *url = [NSURL URLWithString:filePath];
    result = [url setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
}

The result value is YES after the execution but the file is still present in the backup.

I doubt that this file is protected and this fix won't work. Have you any suggestion on how I can proceed?

Thank you,

Chiara

Have you tried configuring your web view to use a non-persistent data store? That seems like the best option here, in that it stops that data getting on to disk in the first place.

To set this up, use the nonPersistentDataStore property.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Avoid backup of Cookies.binarycookies file
 
 
Q