Closed akserg closed 2 months ago
Did you set the value in the info.plist?
Yes, of course
Did you set it with the key OPSQlite_AppGroup? Or did you take the comment literally?
This is also described in the docs
https://ospfranco.notion.site/Configuration-6b8b9564afcc4ac6b6b377fe34475090?pvs=4
Closing this
I figured out the issue. There's no need to pass the location
parameter in shared mode:
let db;
if (Platform.OS === 'ios') {
db = open({ name: 'myDB' });
} else {
db = open({ name: 'myDB', location: ANDROID_DATABASE_PATH });
}
I'm using version 3.0.7, and it always attempts to create/open the database in the IOS_LIBRARY_PATH
folder. I'm not sure if this has been addressed in the latest release.
Thank you for your time, @ospfranco.
location
will always override any value set by the C++ code, this is expected. Glad you solved it!
I'm currently using react-native-sqlite-storage to open a database in shared mode, with several native modules running in the background on iOS. This setup leverages an App Group's Shared Container, allowing access to the same database instance across native modules and the main application, storing the files in the following directory:
.//Shared/AppGroup/4045CAC7-5BC7-4A1C-8D40-EE98C46CFCC0/app.db
I noticed in the code at line 54-55 that you're reading the
appGroupID
from theOPSQLite_AppGroup
key.However, after checking in the Xcode debugger, it seems this code is never reached. Instead, the database files are always created under a different directory:
.//Data/Application/7BEE9A09-790D-4F6E-BA20-6DE1431CC045/Library/app.db
Could you please clarify how to configure OP-SQLITE to work with a shared folder?