Open adamski opened 1 month ago
➤ PM Bot commented:
Jira ticket: RCPP-88
@leemaguire do you have any insight into this issue? It seems to be new, as my iOS builds were working on a previous version of realm-cpp.
@adamski where is the path being set? Did you ensure you're using the documents folder in your apps sandbox?
@leemaguire this is path to the database I'm passing in the app config, in this example showing the absolute path in the Simulator
/Users/adamwilson/Library/Developer/CoreSimulator/Devices/2DFBB86A-A61E-4727-8947-3F5B01AD35AE/data/Containers/Data/Application/4FCA6EE6-7736-45A8-A895-965E7FA3E2FF/Library/Node Audio/Entonal Studio
If you don't pass the custom path does the issue persist? Have you tried looking at file protections in iOS? https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/realm-files/configure-and-open-a-realm/#use-realm-when-the-device-is-locked
The issue only occurs when opening a local realm. If I only open the realm once logged in, it works.
I think I see the issue now - I was assuming I was getting the path from the realm::App
instance but that is not passed in when creating a local realm.
I tried this but got an error saying the path is a directory:
realm::db_config localConfig;
localConfig.set_path(filePath);
localRealm = std::make_unique<realm::db> (std::move (localConfig));
@adamski append "/my_custom_name.realm"
to the filePath
.
Thanks @leemaguire - should the name be different to the synced realm or can they be the same file?
I guess they have to be different.. in which case I'd need to merge local and synced when logged in?
They can be the same, I think this will be useful to you https://github.com/realm/realm-cpp/pull/234.
What happened?
I expected to be able to have realm load inside an app or AUv3 plugin running on iOS.
I got an exception with the message: "Failed to open file at path '/default.realm.lock': Operation not permitted"
I would expect the lock file to be saved in the same location as the database path.
Repro steps
Build an application with Realm 2.2.0, that tries to open a local realm. Build for iOS and run on an iOS device.
Version
2.2.0
Installation method
CMake / CPM
What Atlas Services are you using?
Atlas Device Sync
Compiler
Apple Clang (Xcode)
OS and version
iOS 16
Code snippets
No response
Stacktrace of the exception/crash you're getting
No response
Relevant log output
No response