Replies: 2 comments
|
I ended up setting the attribute right after the NativeSqliteDriver is created by using this function: @OptIn(ExperimentalForeignApi::class)
fun setExcludeFromBackup() {
return memScoped {
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. |
0 replies
|
Side note: I pulled a backup from an iPhone but seemingly developer signed apps are not included in an iPhone backup anyways. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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?
All reactions