Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Realm Swift: Is it possible to keep database after the apps is uninstalled?

Using realm swift, is it possible to keep and maintain the realm database file of the apps in device memory even after the apps is uninstalled from the device?

Thank you very much for any help.

like image 865
David Aditya Avatar asked Jul 13 '16 03:07

David Aditya


People also ask

Where is Realm stored?

A new finder window will open, where you find your Realm inside in the following path (e.g.): AppData/Documents/default. realm (The directory '/private/var/mobile' is the path, which is used by iOS on the device filesystem.

What is iOS Realm database?

Realm is a cross-platform mobile database solution designed for mobile applications that you can integrate with your iOS projects. Unlike wrappers around Core Data, Realm doesn't rely on Core Data or even an SQLite back end. This tutorial introduces you to the basic features of Realm on iOS.

Does Realm work with SwiftUI?

Realm objects have bindings to SwiftUI controls and, much like toggling the bought property, they already start a realm transaction to write the changes in the database whenever you change those values.

How do I delete my Realm data?

The right way of deleting your entire Realm (schema) is to use : Realm realm = Realm. getDefaultInstance(); realm. beginTransaction(); // delete all realm objects realm.


2 Answers

Sadly not. This is a limitation of iOS more than a limitation of Realm. When an iOS app is uninstalled from a device, all of the files associated with it are deleted (including any Realm files).

If you want file data to persist even after the app is deleted, you'll need to look at a cloud hosting solution to hang onto a copy of those files. In this case, the easiest one would most likely be CloudKit.

like image 119
TiM Avatar answered Sep 23 '22 03:09

TiM


Applications all files are leftover when deleting an app. iOS apps are Sandboxed. This means that each App has its own space in disk, with its own directories, which act as the home for the app and its data.

Deleting an app from the iPhone deletes this sandbox, deleting all data associated with the app.

like image 42
Anand Nimje Avatar answered Sep 21 '22 03:09

Anand Nimje