Reputation: 2897
I am attempting to locate the realm DB file on my device (iPhone) and I followed the steps here and here. However, I do not see any realm files in the folder AppData/Documents
.
I print out the URL path as I run the app on my device and my simulator, and this is what I see:
//On device
/private/var/mobile/Containers/Shared/AppGroup/C7332EE4-1567-4C96-8392-7FBD0DC9C863/DB/default.realm
//On simulator
/Users/MYNAME/Library/Developer/CoreSimulator/Devices/D205C50D-F432-4A1F-80CB-FB3D91E0A1EA/data/Containers/Shared/AppGroup/5E67A740-A338-4583-9B9D-461F5D1A734A/DB/default.realm
The URL written on the simulator appears to be any default URL where the Realm DB is written to. I can't seem to understand why can't I find the realm file at AppData/Documents
on the actual device.
Upvotes: 2
Views: 1543
Reputation: 15991
Realm files are only created on disk when you call Realm()
for the first time. Once you've created an instance of Realm, you can find the exact file route of that Realm by printing out realm.configuration.fileURL
. You can normally use Realm.Configuration
to set a different location of the Realm file on disk as opposed to the Documents
directory.
Both of those file paths you displayed show that the file is located in a folder named DB
and it appears to be in an app group (eg, a shared folder between apps and extensions) instead of your app's default Documents
directory.
So with that being said, it would appear that somewhere in your app, a custom Realm.Configuration
object is being used to create the Realm file somewhere else, which would explain why you can't find it in Documents
.
Upvotes: 3