1

I saved some data with Realm on my iPhone, and in AppDelegate, I wrote

        var config = Realm.Configuration()
        let container = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.XXXXXXXX")
        let realmUrl = container!.appendingPathComponent("default.realm")
        config.fileURL = realmUrl
        Realm.Configuration.defaultConfiguration = config

Also, in ExtensionDelegate, I wrote the same.
But when I tried to access data from watch, it shows nothing.
I printed the URL and found that iPhone saves data in

"Developer/CoreSimulator/Devices/21B1330F-3B9D-4A45-9EE4-0D06F9A48866/data/Containers/Shared/AppGroup/3697965E-9A56-447E-B0EB-BC1722DB0BD0/default.realm"

But the watch saves in

"Developer/CoreSimulator/Devices/B190D8C9-A6D8-4BE1-AD8D-7D2805BFA739/data/Containers/Shared/AppGroup/3E621FF7-86FA-4C49-9AC1-20C6C198CB2F/default.realm"

I'm now wondering how to access Realm data saved in my phone from my watch

Now solved by transfering the whole realm file with WatchConnectivity

0 Answers0