You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use sqldelight in a KMM app project. I store sensitive cached data, mostly in the form of base64 encoded images as strings.
It's only meant to be used as a cache when there is no network.
I want to avoid the underlying SQLite db from being included in an iOS backup or iCloud sync/backup.
I ended up setting the attribute right after the NativeSqliteDriver is created by using this function:
@OptIn(ExperimentalForeignApi::class)
fun setExcludeFromBackup(){returnmemScoped{
val databasePath =DatabaseFileContext.databasePath(databaseName, null)
if (NSFileManager.defaultManager.fileExistsAtPath(databasePath)){
val errorRef =alloc<ObjCObjectVar<NSError?>>()Napier.i{"Excluding ${databasePath} from iCloud/Backup!"}
val success =NSURL.fileURLWithPath(databasePath).setResourceValue(NSNumber(bool = true), NSURLIsExcludedFromBackupKey, errorRef.ptr)
if (!success){Napier.i{"Excluding ${databasePath} from iCloud/Backup failed! Reason: ${errorRef.value}"}}}}}
I have yet to test if this does work at all by really doing a backup of a real iphone and check if the database file is not included. So be aware this is untested.
I use sqldelight in a KMM app project. I store sensitive cached data, mostly in the form of base64 encoded images as strings.
It's only meant to be used as a cache when there is no network.
I want to avoid the underlying SQLite db from being included in an iOS backup or iCloud sync/backup.
Theres is a key that one can set for this: NSURLIsExcludedFromBackupKey.
How can I set this on the SQLite DB for the native iOS part of the app?
The text was updated successfully, but these errors were encountered: